Skip to content

Commit

Permalink
Consolidate convert_path tests and just generate the expected value i…
Browse files Browse the repository at this point in the history
…n a platform-sensitive way. Should fix failures on mingw.
  • Loading branch information
jaraco committed Jul 20, 2024
1 parent c4d3c3c commit a166815
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions distutils/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,10 @@ def test_get_platform(self):
with mock.patch.dict('os.environ', {'VSCMD_ARG_TGT_ARCH': 'arm64'}):
assert get_platform() == 'win-arm64'

@pytest.mark.skipif('platform.system() == "Windows"')
def test_convert_path_unix(self):
assert convert_path('/home/to/my/stuff') == '/home/to/my/stuff'
assert convert_path(pathlib.Path('/home/to/my/stuff')) == '/home/to/my/stuff'
assert convert_path('.') == os.curdir

@pytest.mark.skipif('platform.system() != "Windows"')
def test_convert_path_windows(self):
assert convert_path('/home/to/my/stuff') == r'\home\to\my\stuff'
assert convert_path(pathlib.Path('/home/to/my/stuff')) == r'\home\to\my\stuff'
def test_convert_path(self):
expected = os.sep.join(('', 'home', 'to', 'my', 'stuff'))
assert convert_path('/home/to/my/stuff') == expected
assert convert_path(pathlib.Path('/home/to/my/stuff')) == expected
assert convert_path('.') == os.curdir

def test_change_root(self):
Expand Down

0 comments on commit a166815

Please sign in to comment.