diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2013-01-10 03:29:45 +0200 |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2013-01-10 03:29:45 +0200 |
commit | 72291c130dac5b877b3b88445a3f19232b7be64b (patch) | |
tree | f4a2afee77d4fcd6915b2a7f8321e80d7393ea22 /Lib/test/test_genericpath.py | |
parent | fc3e08e85f0c28019e28c94aeffddfd1a470ffbd (diff) | |
parent | 56a70daab94056df38db8ac1d9a74fed82f5824d (diff) | |
download | cpython-72291c130dac5b877b3b88445a3f19232b7be64b.tar.gz |
#16852: merge with 3.3.
Diffstat (limited to 'Lib/test/test_genericpath.py')
-rw-r--r-- | Lib/test/test_genericpath.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py index 060102df73..e967897d75 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 = [] @@ -270,13 +268,17 @@ class GenericTest(unittest.TestCase): self.assertTrue(self.pathmodule.sameopenfile( a.fileno(), b.fileno())) +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', @@ -407,9 +409,5 @@ class CommonTest(GenericTest): self.test_abspath() -def test_main(): - support.run_unittest(GenericTest) - - if __name__=="__main__": - test_main() + unittest.main() |