Skip to content

Commit 481bf3e

Browse files
committed
Actually fix world tests
1 parent afa36a1 commit 481bf3e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test_world.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Tests for worlds"""
22
import importlib.util
3+
import operator
34
import os
45
from pathlib import Path
56

@@ -18,6 +19,10 @@
1819
]
1920

2021

22+
def fix_world(world):
23+
world.maps.sort(key=operator.attrgetter("map_file"))
24+
25+
2126
@pytest.mark.parametrize("world_test", ALL_WORLD_TESTS)
2227
def test_world_integration(world_test):
2328
# it's a PITA to import like this, don't do it
@@ -32,4 +37,11 @@ def test_world_integration(world_test):
3237

3338
casted_world = world.parse_world(raw_world_path)
3439

40+
# These fix calls sort the map list in the world by the map_file
41+
# attribute because we don't actually care about the order of the list
42+
# and it can vary between runs, but pytest will fail if it is
43+
# not in the same order.
44+
fix_world(casted_world)
45+
fix_world(expected.EXPECTED)
46+
3547
assert casted_world == expected.EXPECTED

0 commit comments

Comments
 (0)