Skip to content

Commit c2831a9

Browse files
committed
Skip test if mocked functions are unavailable
1 parent b873e05 commit c2831a9

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Lib/test/test_tarfile.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4516,6 +4516,9 @@ def test_chmod_outside_dir(self):
45164516
self.assertNotEqual(st_mode & 0o777, 0o777)
45174517

45184518
@symlink_test
4519+
@unittest.skipUnless(hasattr(os, 'chown'), "missing os.chown")
4520+
@unittest.skipUnless(hasattr(os, 'lchown'), "missing os.lchown")
4521+
@unittest.skipUnless(hasattr(os, 'geteuid'), "missing os.geteuid")
45194522
@support.subTests('link_type', (tarfile.SYMTYPE, tarfile.LNKTYPE))
45204523
def test_chown_links_on_extract(self, link_type):
45214524
with ArchiveMaker() as arc:
@@ -4549,6 +4552,9 @@ def test_chown_links_on_extract(self, link_type):
45494552
mock_lchown.assert_not_called()
45504553

45514554
@symlink_test
4555+
@unittest.skipUnless(hasattr(os, 'chown'), "missing os.chown")
4556+
@unittest.skipUnless(hasattr(os, 'lchown'), "missing os.lchown")
4557+
@unittest.skipUnless(hasattr(os, 'geteuid'), "missing os.geteuid")
45524558
@support.subTests('link_type', (tarfile.SYMTYPE, tarfile.LNKTYPE))
45534559
def test_chown_links_on_extractall(self, link_type):
45544560
with ArchiveMaker() as arc:

0 commit comments

Comments
 (0)