Skip to content

Commit e17b0f0

Browse files
committed
Skip tests if required flags are missing
1 parent 4b3f6d7 commit e17b0f0

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Lib/test/test_os.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,6 +2681,7 @@ def test_no_flags(self):
26812681
with self.assertRaises(FileExistsError):
26822682
os.linkat(os.AT_FDCWD, src2, os.AT_FDCWD, dst) # flags=0
26832683

2684+
@unittest.skipUnless(hasattr(os, 'O_TMPFILE'), 'need os.O_TMPFILE')
26842685
def check_flag(self, flag):
26852686
filename = os_helper.TESTFN
26862687
self.addCleanup(os_helper.unlink, filename)
@@ -2700,9 +2701,13 @@ def check_flag(self, flag):
27002701
with open(filename, encoding='utf8') as fp:
27012702
self.assertEqual(fp.read(), 'hello')
27022703

2704+
@unittest.skipUnless(hasattr(os, 'AT_EMPTY_PATH'),
2705+
'need os.AT_EMPTY_PATH')
27032706
def test_empty_path(self):
27042707
self.check_flag(os.AT_EMPTY_PATH)
27052708

2709+
@unittest.skipUnless(hasattr(os, 'AT_SYMLINK_FOLLOW'),
2710+
'need os.AT_SYMLINK_FOLLOW')
27062711
def test_symlink_follow(self):
27072712
self.check_flag(os.AT_SYMLINK_FOLLOW)
27082713

0 commit comments

Comments
 (0)