diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2013-01-10 01:12:50 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2013-01-10 01:12:50 (GMT) |
commit | d0dfe9ad463f5d3a76af23df8bfd9c9d1915b328 (patch) | |
tree | 7f52b577fe45e54e934305b459a943fd93a6607f /Lib/test/test_genericpath.py | |
parent | 0c270a8bb748f09b7de6f6ce21d405e0c83be329 (diff) | |
download | cpython-d0dfe9ad463f5d3a76af23df8bfd9c9d1915b328.zip cpython-d0dfe9ad463f5d3a76af23df8bfd9c9d1915b328.tar.gz cpython-d0dfe9ad463f5d3a76af23df8bfd9c9d1915b328.tar.bz2 |
#16852: test_genericpath, test_posixpath, test_ntpath, and test_macpath now work with unittest test discovery. Patch by Zachary Ware.
Diffstat (limited to 'Lib/test/test_genericpath.py')
-rw-r--r-- | Lib/test/test_genericpath.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py index 08061fa..fd8bc57 100644 --- a/Lib/test/test_genericpath.py +++ b/Lib/test/test_genericpath.py @@ -17,9 +17,7 @@ def safe_rmdir(dirname): pass -class GenericTest(unittest.TestCase): - # The path module to be tested - pathmodule = genericpath +class GenericTest: common_attributes = ['commonprefix', 'getsize', 'getatime', 'getctime', 'getmtime', 'exists', 'isdir', 'isfile'] attributes = [] @@ -190,13 +188,16 @@ class GenericTest(unittest.TestCase): support.unlink(support.TESTFN) safe_rmdir(support.TESTFN) +class TestGenericTest(GenericTest, unittest.TestCase): + # Issue 16852: GenericTest can't inherit from unittest.TestCase + # for test discovery purposes; CommonTest inherits from GenericTest + # and is only meant to be inherited by others. + pathmodule = genericpath # Following TestCase is not supposed to be run from test_genericpath. # It is inherited by other test modules (macpath, ntpath, posixpath). class CommonTest(GenericTest): - # The path module to be tested - pathmodule = None common_attributes = GenericTest.common_attributes + [ # Properties 'curdir', 'pardir', 'extsep', 'sep', @@ -328,9 +329,5 @@ class CommonTest(GenericTest): self.test_abspath() -def test_main(): - support.run_unittest(GenericTest) - - if __name__=="__main__": - test_main() + unittest.main() |