diff options
author | Barney Gale <barney.gale@gmail.com> | 2023-11-18 17:06:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-18 17:06:10 (GMT) |
commit | 607b5e30c67bad35b90240d9ac176131e51423a5 (patch) | |
tree | 43c6ba0b10c5bd1a9386ef2be344a2450dd83d8c /Lib/test/test_pathlib.py | |
parent | 9c7c8bacc140b0ce7bbb17b1756a1ea9fb376983 (diff) | |
download | cpython-607b5e30c67bad35b90240d9ac176131e51423a5.zip cpython-607b5e30c67bad35b90240d9ac176131e51423a5.tar.gz cpython-607b5e30c67bad35b90240d9ac176131e51423a5.tar.bz2 |
GH-110109: Test pure functionality of `pathlib.Path` user subclasses (#112242)
Add `PurePathTest` as a superclass of `PathTest`, and therefore also
`PathSubclassTest`. This adds coverage of pure functionality in user
subclasses of `pathlib.Path`.
Remove `PosixPathAsPureTest` and `WindowsPathAsPureTest`, as they
now duplicate `PosixPathTest` and `WindowsPathTest`.
This makes the MROs of test unit classes match the MROs of pathlib
classes.
Diffstat (limited to 'Lib/test/test_pathlib.py')
-rw-r--r-- | Lib/test/test_pathlib.py | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py index 597483d..7083e9e 100644 --- a/Lib/test/test_pathlib.py +++ b/Lib/test/test_pathlib.py @@ -1569,15 +1569,6 @@ class PurePathSubclassTest(PurePathTest): test_repr_roundtrips = None -@only_posix -class PosixPathAsPureTest(PurePosixPathTest): - cls = pathlib.PosixPath - -@only_nt -class WindowsPathAsPureTest(PureWindowsPathTest): - cls = pathlib.WindowsPath - - # # Tests for the virtual classes. # @@ -1771,6 +1762,7 @@ class DummyPathTest(unittest.TestCase): # def setUp(self): + super().setUp() pathmod = self.cls.pathmod p = self.cls(BASE) p.mkdir(parents=True) @@ -2793,7 +2785,7 @@ class DummyPathWithSymlinksTest(DummyPathTest): # Tests for the concrete classes. # -class PathTest(DummyPathTest): +class PathTest(DummyPathTest, PurePathTest): """Tests for the FS-accessing functionalities of the Path classes.""" cls = pathlib.Path can_symlink = os_helper.can_symlink() @@ -3409,7 +3401,7 @@ class PathTest(DummyPathTest): @only_posix -class PosixPathTest(PathTest): +class PosixPathTest(PathTest, PurePosixPathTest): cls = pathlib.PosixPath def test_absolute(self): @@ -3585,7 +3577,7 @@ class PosixPathTest(PathTest): @only_nt -class WindowsPathTest(PathTest): +class WindowsPathTest(PathTest, PureWindowsPathTest): cls = pathlib.WindowsPath def test_absolute(self): |