From 0be3bf7f49ec92ee3515bf549441d0054538b057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 5 Sep 2017 11:25:25 +0200 Subject: [PATCH] Fixed unit test, it still mocked sys.platform We now use platform.system() to detect the platform. --- tests/test_path_replacement.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/test_path_replacement.py b/tests/test_path_replacement.py index 4064652..fb595d1 100644 --- a/tests/test_path_replacement.py +++ b/tests/test_path_replacement.py @@ -83,8 +83,13 @@ class PathReplacementTest(unittest.TestCase): def _do_test(self, test_paths, platform, 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: + as_path_instance = pathclass(input_path) self.assertEqual(expected_result, - self.test_manager.replace_path(pathclass(input_path)), - 'for input %s on platform %s' % (input_path, platform)) + self.test_manager.replace_path(as_path_instance), + 'for input %r on platform %s' % (as_path_instance, platform))