Skip to content

Commit 8e00501

Browse files
committed
test: fix windows path separator
Make list of files in a stable order for comparison.
1 parent 82f8f80 commit 8e00501

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

tests/test_cli.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import sys
23
from pathlib import Path
34

45
from click.testing import CliRunner
@@ -33,8 +34,11 @@ def test_collect_autograding_tests_command():
3334

3435
result = runner.invoke(collect_autograding_tests_command)
3536
assert result.exit_code == 0
36-
assert result.output == "processing lorem-ipsum/problem.toml\n"
37-
expected_file_path = Path("./.github/classroom/autograding.json")
37+
if sys.platform == "win32":
38+
assert result.output == "processing lorem-ipsum\\problem.toml\n"
39+
else:
40+
assert result.output == "processing lorem-ipsum/problem.toml\n"
41+
expected_file_path = Path(".github") / "classroom" / "autograding.json"
3842
assert expected_file_path.exists()
3943
with open(expected_file_path) as f:
4044
data = json.load(f)

tests/test_common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ def test_populate_folder_with_filenames():
9292
expected_files = ["a", "b", "c"]
9393
populate_folder_with_filenames(tmpdir, expected_files)
9494

95-
result_names = [item.name for item in tmpdir_path.iterdir()]
95+
# Order should not matter, we just want check that all files are created.
96+
result_names = sorted([item.name for item in tmpdir_path.iterdir()])
9697

9798
assert result_names == expected_files
9899

0 commit comments

Comments
 (0)