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).
This commit is contained in:
Tim Peters 2001-09-09 06:12:01 +00:00
parent 90ba8d9c80
commit a0a6222509
8 changed files with 95 additions and 27 deletions

View file

@ -1351,16 +1351,16 @@ __test__ = {"tut": tutorial_tests,
# 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_generators
def test_main(verbose=None):
import doctest, test_support, test_generators
if 0: # change to 1 to run forever (to check for leaks)
while 1:
doctest.master = None
doctest.testmod(test_generators)
test_support.run_doctest(test_generators, verbose)
print ".",
else:
doctest.testmod(test_generators)
test_support.run_doctest(test_generators, verbose)
# This part isn't needed for regrtest, but for running the test directly.
if __name__ == "__main__":
test_main()
test_main(1)