mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
GH-73991: pathlib ABC tests: add DummyPath.unlink()
and rmdir()
(#120715)
In preparation for the addition of `PathBase.rmtree()`, implement `DummyPath.unlink()` and `rmdir()`, and move corresponding tests into `test_pathlib_abc` so they're run against `DummyPath`.
This commit is contained in:
parent
b7f478948f
commit
9f741e55c1
2 changed files with 51 additions and 20 deletions
|
@ -764,25 +764,6 @@ class PathTest(test_pathlib_abc.DummyPathTest, PurePathTest):
|
|||
self.assertEqual(expected_gid, gid_2)
|
||||
self.assertEqual(expected_name, link.group(follow_symlinks=False))
|
||||
|
||||
def test_unlink(self):
|
||||
p = self.cls(self.base) / 'fileA'
|
||||
p.unlink()
|
||||
self.assertFileNotFound(p.stat)
|
||||
self.assertFileNotFound(p.unlink)
|
||||
|
||||
def test_unlink_missing_ok(self):
|
||||
p = self.cls(self.base) / 'fileAAA'
|
||||
self.assertFileNotFound(p.unlink)
|
||||
p.unlink(missing_ok=True)
|
||||
|
||||
def test_rmdir(self):
|
||||
p = self.cls(self.base) / 'dirA'
|
||||
for q in p.iterdir():
|
||||
q.unlink()
|
||||
p.rmdir()
|
||||
self.assertFileNotFound(p.stat)
|
||||
self.assertFileNotFound(p.unlink)
|
||||
|
||||
@os_helper.skip_unless_hardlink
|
||||
def test_hardlink_to(self):
|
||||
P = self.cls(self.base)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue