Skip to content

Commit a950abc

Browse files
committed
Test importing built library
1 parent b75ad60 commit a950abc

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

hatch_cpp/structs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def get_flags(self, library: HatchCppLibrary) -> str:
117117
flags += " " + " ".join(f"/LIBPATH:{lib}" for lib in library.library_dirs)
118118
flags += " " + " ".join(f"/D{macro}" for macro in library.define_macros)
119119
flags += " " + " ".join(f"/U{macro}" for macro in library.undef_macros)
120-
flags += f" /Fo{library.name}.pyd"
120+
flags += f" /Fe{library.name}.pyd"
121121
# clean
122122
while flags.count(" "):
123123
flags = flags.replace(" ", " ")

hatch_cpp/tests/test_project_basic.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from os import listdir
2+
from pathlib import Path
23
from shutil import rmtree
34
from subprocess import check_output
4-
from sys import platform
5+
from sys import path, platform
56

67

78
class TestProject:
@@ -20,3 +21,8 @@ def test_basic(self):
2021
assert "extension.pyd" in listdir("hatch_cpp/tests/test_project_basic/basic_project")
2122
else:
2223
assert "extension.so" in listdir("hatch_cpp/tests/test_project_basic/basic_project")
24+
here = Path(__file__).parent / "test_project_basic"
25+
path.insert(0, str(here))
26+
import basic_project.extension
27+
28+
assert basic_project.extension.hello() == "A string"

0 commit comments

Comments
 (0)