summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_genericpath.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-01-10 01:29:45 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2013-01-10 01:29:45 (GMT)
commit11b3a6056fd67862311f3992bfea5442ef011821 (patch)
treed2fe654859a42fe38f6311f09789c4df7d3f13bb /Lib/test/test_genericpath.py
parentf424f3856da382e0d430692e09a0da07e7d8d02a (diff)
parentd0dfe9ad463f5d3a76af23df8bfd9c9d1915b328 (diff)
downloadcpython-11b3a6056fd67862311f3992bfea5442ef011821.zip
cpython-11b3a6056fd67862311f3992bfea5442ef011821.tar.gz
cpython-11b3a6056fd67862311f3992bfea5442ef011821.tar.bz2
#16852: merge with 3.3.
Diffstat (limited to 'Lib/test/test_genericpath.py')
-rw-r--r--Lib/test/test_genericpath.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/Lib/test/test_genericpath.py b/Lib/test/test_genericpath.py
index 060102d..e967897 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()