Fixed unit test, it still mocked sys.platform
We now use platform.system() to detect the platform.
This commit is contained in:
parent
f207e14664
commit
0be3bf7f49
@ -83,8 +83,13 @@ class PathReplacementTest(unittest.TestCase):
|
|||||||
|
|
||||||
def _do_test(self, test_paths, platform, pathclass):
|
def _do_test(self, test_paths, platform, pathclass):
|
||||||
self.test_manager.PurePlatformPath = pathclass
|
self.test_manager.PurePlatformPath = pathclass
|
||||||
with unittest.mock.patch('sys.platform', platform):
|
|
||||||
|
def mocked_system():
|
||||||
|
return platform
|
||||||
|
|
||||||
|
with unittest.mock.patch('platform.system', mocked_system):
|
||||||
for expected_result, input_path in test_paths:
|
for expected_result, input_path in test_paths:
|
||||||
|
as_path_instance = pathclass(input_path)
|
||||||
self.assertEqual(expected_result,
|
self.assertEqual(expected_result,
|
||||||
self.test_manager.replace_path(pathclass(input_path)),
|
self.test_manager.replace_path(as_path_instance),
|
||||||
'for input %s on platform %s' % (input_path, platform))
|
'for input %r on platform %s' % (as_path_instance, platform))
|
||||||
|
Reference in New Issue
Block a user