Skip to content

Commit f0fba60

Browse files
author
Victor Verbeke
authored
Fix tests on Windows (#55)
* Fix run command with interpreter, fix test paths Two problems fixed: - Bug introduced in previous merge request that would crash Run by giving it a bad kwarg. Reverted to self.shell, but used the e3.sys.interpreter to be more flexible. - Replaced the tests naming by setting a tests_subdir instead of a test_name method, which would crash Windows tests. TN: V223-017
1 parent e24f882 commit f0fba60

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

regtests/test_support.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
import os
77
import sys
88

9-
# Change directory
10-
TEST = sys.modules["__main__"]
11-
TESTDIR = os.path.dirname(os.path.realpath(TEST.__file__))
12-
TEST_NAME = os.path.basename(TESTDIR)
13-
os.chdir(TESTDIR)
14-
159

1610
def gprbuild(prj):
1711
"""Compile a project with gprbuild"""

regtests/testsuite.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from e3.env import Env
1313
from e3.os.process import Run
1414
from e3.fs import mkdir, rm
15+
from e3.sys import interpreter
1516

1617
import e3.testsuite
1718
from e3.testsuite import Testsuite
@@ -28,9 +29,14 @@ def run(self):
2829
2930
Executes the test.py command inside the tests and compares the results.
3031
"""
31-
cmd = ["python", "test.py"]
32+
cmd = [interpreter(), "test.py"]
3233
start_time = time.time()
33-
run = Run(cmd, catch_error=False)
34+
run = self.shell(
35+
cmd,
36+
cwd=self.test_env["working_dir"],
37+
catch_error=False,
38+
timeout=None,
39+
)
3440
self.result.time = time.time() - start_time
3541

3642

@@ -40,10 +46,7 @@ class TPTestsuite(Testsuite):
4046
test_driver_map = {"basic": BasicTestDriver}
4147
default_driver = "basic"
4248

43-
def test_name(self, test_dir):
44-
# Return the last directory name as the test name.
45-
test_directory_name = test_dir.split("/")[-1]
46-
return test_directory_name
49+
tests_subdir = "tests"
4750

4851
def __init__(self):
4952
super().__init__()

0 commit comments

Comments
 (0)