Skip to content

Commit 49113b5

Browse files
committed
fix ete on windows
1 parent 49c42a5 commit 49113b5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Tests/EndToEnd/test_examples.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77

88
def getBinDir():
99
if len(sys.argv) != 2:
10+
return "C:\\Users\\Sylwek\\Desktop\\7bitDI\\cmake-build-debug\\bin"
1011
raise Exception("binary directory not provided")
11-
return sys.argv[1]
12+
binDir = sys.argv[1]
13+
if not os.path.exists(binDir):
14+
raise Exception("Binary directory does not exist")
15+
return binDir
1216

1317

1418
class ExamplesTest:
@@ -18,7 +22,8 @@ def __init__(self, binDir):
1822
self.expectedTestMap = self.__getExpectedTestMap()
1923

2024
def __getAvailableExamples(self):
21-
paths = [os.path.join(self.binDir, f) for f in os.listdir(self.binDir) if "Example" in f]
25+
paths = [os.path.join(self.binDir, f) for f in os.listdir(self.binDir) if
26+
"Example" in f and os.path.splitext(f)[1] in [".exe", ""]]
2227
return [f for f in paths if os.path.isfile(f)]
2328

2429
def __getExpectedTestMap(self):
@@ -35,7 +40,8 @@ def __runTest(self, examplePath, expected):
3540
raise Exception(f"result of running example: '{result.stdout}' does not match expected: '{expected}'")
3641

3742
def __runTestAndSummarize(self, examplePath):
38-
name = os.path.basename(examplePath).split('.')[-1].replace("Example", "")
43+
fileName = os.path.basename(examplePath)
44+
name = os.path.splitext(fileName)[0].replace("Example", "")
3945
try:
4046
self.__runTest(examplePath, self.expectedTestMap.get(name))
4147
print(f"{name} example test succeeded")

0 commit comments

Comments
 (0)