Skip to content

Commit 24683d0

Browse files
committed
EmbeddedPythonTest gives helpful error message if test file is not found
1 parent f94f97f commit 24683d0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/embed_tests/TestPythonTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@ public void EmbeddedPythonTest(string testFile, string testName)
4040
folder = Path.GetDirectoryName(folder);
4141
}
4242
folder = Path.Combine(folder, "tests");
43+
string path = Path.Combine(folder, testFile + ".py");
44+
if (!File.Exists(path)) throw new FileNotFoundException("Cannot find test file", path);
4345

4446
PythonEngine.Exec($@"
4547
import sys
4648
sys.path.insert(0, r'{folder}')
47-
from {testFile} import *
48-
{testName}()
49+
import {testFile}
50+
{testFile}.{testName}()
4951
");
5052
}
5153
}

0 commit comments

Comments
 (0)