[issue15178] Doctest should handle situations when test files are not readable
Bohuslav "Slavek" Kabrda
report at bugs.python.org
Tue Jul 3 09:17:01 CEST 2012
Bohuslav "Slavek" Kabrda <bkabrda at redhat.com> added the comment:
Fifth version :)
- On failure in a loaded test, the _test function returns, so this behaviour is preserved.
- During _test function, count of both loaded and non-loaded files is kept.
- If a file fails to be loaded, the tests continue, but a non-zero return code is returned. Moreover, the results of loaded and non-loaded files are printed after each invocation.
This is a sample output:
$ python3 -m doctest -v spam c.py beans
Cannot read 'spam': [Errno 2] No such file or directory: 'spam'
2 * 2
1 items passed all tests:
1 tests in c
1 tests in 1 items.
1 passed and 0 failed.
Cannot read 'beans': [Errno 2] No such file or directory: 'beans'
Test files read successfully: 1
Unreadable files: 2
Does this look better?
Added file: http://bugs.python.org/file26239/doctest-dont-end-with-exception-on-unreadable-files-v5.patch
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list