Skip to content

Commit

Permalink
So doctests under -OO got broken in Python>3.9
Browse files Browse the repository at this point in the history
- yay python
  • Loading branch information
metatoaster committed Jul 2, 2022
1 parent 9061026 commit 55eeee2
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions src/calmjs/parse/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,25 @@ def open(p, flag='r'):
'calmjs.parse.tests', pattern='test_*.py',
top_level_dir=dirname(__file__)
)
test_suite.addTest(doctest.DocTestSuite(es5lexer, optionflags=optflags))
test_suite.addTest(doctest.DocTestSuite(walkers, optionflags=optflags))
test_suite.addTest(doctest.DocTestSuite(sourcemap, optionflags=optflags))
test_suite.addTest(doctest.DocTestCase(
# skipping all the error case tests which should all be in the
# troubleshooting section at the end; bump the index whenever
# more failure examples are added.
# also note that line number is unknown, as PKG_INFO has headers
# and also the counter is somehow inaccurate in this case.
doctest.DocTest(pkgdesc_tests[:-1], {
'open': open}, 'PKG_INFO', 'README.rst', None, pkgdesc),
optionflags=optflags,
))
try:
test_suite.addTest(doctest.DocTestSuite(
es5lexer, optionflags=optflags))
test_suite.addTest(doctest.DocTestSuite(
walkers, optionflags=optflags))
test_suite.addTest(doctest.DocTestSuite(
sourcemap, optionflags=optflags))
test_suite.addTest(doctest.DocTestCase(
# skipping all the error case tests which should all be in the
# troubleshooting section at the end; bump the index whenever
# more failure examples are added.
# also note that line number is unknown, as PKG_INFO has headers
# and also the counter is somehow inaccurate in this case.
doctest.DocTest(pkgdesc_tests[:-1], {
'open': open}, 'PKG_INFO', 'README.rst', None, pkgdesc),
optionflags=optflags,
))
except AttributeError:
# Assuming this is in Python>3.9 where the -OO flag was used...
pass

return test_suite

0 comments on commit 55eeee2

Please sign in to comment.