[New-bugs-announce] [issue17689] Fix test discovery for test_tarfile.py

Zachary Ware report at bugs.python.org
Wed Apr 10 20:40:49 CEST 2013


New submission from Zachary Ware:

Here's a patch for test_tarfile.py discovery.

There are a couple of inheritance issues resolved; CommonReadTest (and its children, MiscReadTest and StreamReadTest) are changed simply to avoid running the tests in CommonReadTest on their own--they pass, but are unnecessary.  LongnameTest and WriteTestBase cause failures when run on their own, so they no longer inherit from unittest.TestCase.

test_main() has been replaced by setUpModule, some skip decorators, and tearDownModule.  HardlinkTest and LinkEmulationTest are given skipUnless and skipIf decorators, respectively, instead of simply being appended to 'tests' or not.  This does change the test count; on my machine it adds the 4 tests skipped in LinkEmulationTest, raising the total from 307 to 311.  gzip, bz2, and lzma setup has been moved into setUpModule, and each group of those tests now has a new dummy base class with a skip decorator.  This will also change test counts on machines that don't have gzip, bz2, or lzma available.  tearDownModule replaces the finally clause at the end of test_main().

A simpler patch would just convert test_main into load_tests and add a tearDownModule function to replace the finally clause of test_main(), but I believe this slightly more invasive approach is more correct and should simplify future maintenance of the module.

Thanks,

Zach

----------
components: Tests
files: test_tarfile_discovery.diff
keywords: patch
messages: 186525
nosy: brett.cannon, ezio.melotti, zach.ware
priority: normal
severity: normal
status: open
title: Fix test discovery for test_tarfile.py
type: behavior
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file29765/test_tarfile_discovery.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17689>
_______________________________________


More information about the New-bugs-announce mailing list