Skip to content

Commit c2d657f

Browse files
committed
Skip tests the unittest way
1 parent d69d03b commit c2d657f

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

tests/test_pathutils.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@ def posix_to_native(rootfs: str, cwd: str, path: str) -> str:
2828

2929

3030
class TestPathUtils(unittest.TestCase):
31+
@unittest.skipUnless(is_posix_host, 'POSIX host only')
3132
def test_convert_nt_to_posix(self):
32-
# test only on a POSIX host
33-
if not is_posix_host:
34-
self.skipTest('POSIX host only')
35-
3633
rootfs = PurePosixPath(r'../examples/rootfs/x86_windows')
3734

3835
expected = str(realpath(rootfs) / 'test')
@@ -74,11 +71,8 @@ def test_convert_nt_to_posix(self):
7471
self.assertEqual(expected, nt_to_native(str(rootfs), 'C:\\Windows\\System32\\drivers', '..\\..\\test'))
7572
self.assertEqual(expected, nt_to_native(str(rootfs), 'C:\\Windows\\System32', '..\\xxxx\\..\\test'))
7673

74+
@unittest.skipUnless(is_nt_host, 'NT host only')
7775
def test_convert_posix_to_nt(self):
78-
# test only on a Windows host
79-
if not is_nt_host:
80-
self.skipTest('NT host only')
81-
8276
rootfs = PureWindowsPath(r'../examples/rootfs/x86_linux')
8377

8478
expected = str(realpath(rootfs) / 'test')

0 commit comments

Comments
 (0)