Skip to content

Commit bb73454

Browse files
committed
fix bug in the test for runner: comparing string instead of real comparison with versions
1 parent 27caf8d commit bb73454

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

grid2op/tests/test_Runner.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import json
1212
import unittest
1313
import pdb
14+
import packaging
15+
from packaging import version
1416

1517
from grid2op.tests.helper_path_test import *
1618

@@ -456,8 +458,15 @@ def _aux_backward(self, base_path, g2op_version_txt, g2op_version):
456458
)
457459
except Exception as exc_:
458460
raise exc_
459-
460-
if g2op_version <= "1.4.0":
461+
g2op_ver = ""
462+
try:
463+
g2op_ver = version.parse(g2op_version)
464+
except packaging.version.InvalidVersion:
465+
if g2op_version != "test_version":
466+
g2op_ver = version.parse("0.0.1")
467+
else:
468+
g2op_ver = version.parse("1.4.1")
469+
if g2op_ver <= version.parse("1.4.0"):
461470
assert (
462471
EpisodeData.get_grid2op_version(full_episode_path) == "<=1.4.0"
463472
), "wrong grid2op version stored (grid2op version <= 1.4.0)"

0 commit comments

Comments
 (0)