Skip to content

Commit c12c68f

Browse files
committed
Fix test cases for Python3
1 parent 0010ba8 commit c12c68f

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

test/test_file.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,18 +256,26 @@ def platform_win(self):
256256
def platform_linux(self):
257257
return "linux"
258258

259-
@pytest.mark.parametrize(["value", "patch", "expected"], [
260-
[reserved.lower(), platform_win, reserved.lower() + "_"]
259+
@pytest.mark.parametrize(["value", "test_platform", "expected"], [
260+
[reserved.lower(), "windows", reserved.lower() + "_"]
261261
for reserved in WIN_RESERVED_FILE_NAME_LIST
262262
] + [
263-
[reserved.upper(), platform_win, reserved.upper() + "_"]
263+
[reserved.upper(), "windows", reserved.upper() + "_"]
264264
for reserved in WIN_RESERVED_FILE_NAME_LIST
265265
] + [
266-
[reserved, platform_linux, reserved]
266+
[reserved, "linux", reserved]
267267
for reserved in WIN_RESERVED_FILE_NAME_LIST
268268
])
269269
def test_normal_win_reserved_name(
270-
self, monkeypatch, value, patch, expected):
270+
self, monkeypatch, value, test_platform, expected):
271+
if test_platform == "windows":
272+
patch = self.platform_win
273+
elif test_platform == "linux":
274+
patch = self.platform_linux
275+
else:
276+
raise ValueError(
277+
"unexpected test platform: {}".format(test_platform))
278+
271279
monkeypatch.setattr(
272280
FileSanitizer, "platform_name", patch)
273281

0 commit comments

Comments
 (0)