[New-bugs-announce] [issue18266] Fix test discovery for test_largefile.py
report at bugs.python.org
Wed Jun 19 23:00:54 CEST 2013
New submission from Zachary Ware:
This one is another inheritance issue. The patch removes unittest.TestCase as a base for LargeFileTest and converts test_main into setUpModule, load_tests, and tearDownModule. This seems like the way to go due to the fact that the order of test execution matters: test_seek must be first and test_truncate must be last. The only way around that restriction would be to create a new copy of the file for test_truncate, which would make the test take even longer and use even more resources.
Also, the programmatic creation of the C and Py variants of the test has been changed from creating an empty subclass of LargeFileTest which is then renamed and assigned an 'open' attr, to using the three-arg form of type to create a subclass of LargeFileTest and unittest.TestCase with name set and an 'open' attr pointing to the correct function.
Lastly, the superfluous check on whether f.truncate is available that had been in test_main is now removed so that the test is properly marked as skipped if skipped.
nosy: brett.cannon, ezio.melotti, zach.ware
title: Fix test discovery for test_largefile.py
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file30651/test_largefile_discovery.diff
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce