From b3692fe40463a81f83f75f4a9e1a68b332b94aea Mon Sep 17 00:00:00 2001
From: Anthony Sottile <asottile@umich.edu>
Date: Mon, 7 Feb 2022 15:10:03 -0500
Subject: [PATCH] work around test pollution caused by new setuptools mutating
 global logger level

---
 testing/test_doctest.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/testing/test_doctest.py b/testing/test_doctest.py
index e85f44f93..c2c832720 100644
--- a/testing/test_doctest.py
+++ b/testing/test_doctest.py
@@ -802,11 +802,12 @@ class TestDoctests:
         p = pytester.makepyfile(
             setup="""
             from setuptools import setup, find_packages
-            setup(name='sample',
-                  version='0.0',
-                  description='description',
-                  packages=find_packages()
-            )
+            if __name__ == '__main__':
+                setup(name='sample',
+                      version='0.0',
+                      description='description',
+                      packages=find_packages()
+                )
         """
         )
         result = pytester.runpytest(p, "--doctest-modules")