tests/test-doctest.py
changeset 52131 cf8d029a480b
parent 52130 479899e53816
child 52651 f066fc0bdc7a
--- a/tests/test-doctest.py	Mon Oct 07 12:08:48 2024 +0100
+++ b/tests/test-doctest.py	Sun Oct 27 17:29:18 2024 -0400
@@ -43,7 +43,17 @@
     checker = py3docchecker()
     runner = doctest.DocTestRunner(checker=checker, optionflags=optionflags)
     for test in finder.find(mod, name):
-        runner.run(test)
+        # Windows doesn't have time.tzset(), so skip methods that invoke it in
+        # a doctest, without hardcoding the function name.  There is a feature
+        # request for adding syntax to the test itself to conditionally skip
+        # that would make this unnecessary:
+        #
+        # https://github.com/python/cpython/issues/117364
+        for example in test.examples:
+            if os.name == 'nt' and 'time.tzset()' in example.source:
+                break
+        else:
+            runner.run(test)
     runner.summarize()