diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-09-09 06:12:01 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-09-09 06:12:01 (GMT) |
commit | a0a62225094a890c1b07ebc4f89e4c7c45c66b13 (patch) | |
tree | 147057adad1ae5b6548b708753a2febe91080d5f /Lib/test/test_descrtut.py | |
parent | 90ba8d9c80c4eba418ca2ddaefbf59c4acf00cf3 (diff) | |
download | cpython-a0a62225094a890c1b07ebc4f89e4c7c45c66b13.zip cpython-a0a62225094a890c1b07ebc4f89e4c7c45c66b13.tar.gz cpython-a0a62225094a890c1b07ebc4f89e4c7c45c66b13.tar.bz2 |
Teach regrtest how to pass on doctest failure msgs. This is done via a
horridly inefficient hack in regrtest's Compare class, but it's about as
clean as can be: regrtest has to set up the Compare instance before
importing a test module, and by the time the module *is* imported it's too
late to change that decision. The good news is that the more tests we
convert to unittest and doctest, the less the inefficiency here matters.
Even now there are few tests with large expected-output files (the new
cost here is a Python-level call per .write() when there's an expected-
output file).
Diffstat (limited to 'Lib/test/test_descrtut.py')
-rw-r--r-- | Lib/test/test_descrtut.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Lib/test/test_descrtut.py b/Lib/test/test_descrtut.py index 1f8f5c8..a0fe0f1 100644 --- a/Lib/test/test_descrtut.py +++ b/Lib/test/test_descrtut.py @@ -484,10 +484,15 @@ __test__ = {"tut1": test_1, # This worms around a bootstrap problem. # Note that doctest and regrtest both look in sys.argv for a "-v" argument, # so this works as expected in both ways of running regrtest. -def test_main(): - import doctest, test.test_descrtut - doctest.testmod(test.test_descrtut) +def test_main(verbose=None): + # Obscure: import this module as test.test_descrtut instead of as + # plain test_descrtut because the name of this module works its way + # into the doctest examples, and unless the full test.test_descrtut + # business is used the name can change depending on how the test is + # invoked. + import test_support, test.test_descrtut + test_support.run_doctest(test.test_descrtut, verbose) # This part isn't needed for regrtest, but for running the test directly. if __name__ == "__main__": - test_main() + test_main(1) |