Skip to content

Commit d7362ec

Browse files
committed
WIP: separated smoke dll tests from unit for pytesting
1 parent 7a7d938 commit d7362ec

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

cmake/tests.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ add_test(NAME PYBIND_PYVER_TEST
4242
COMMAND ${PYTHON_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/tests/integration_tests/pybinds_tests/test_pybind_pyver.py
4343
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
4444
)
45+
add_test(NAME PYBIND_DLL_SMOKE_TEST
46+
COMMAND ${PYTHON_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/tests/integration_tests/pybinds_tests/test_pybind_dll_smoke.py
47+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
48+
)
4549
add_test(NAME PYBIND_UNIT_TEST
4650
COMMAND ${PYTHON_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/tests/integration_tests/pybinds_tests/test_pybind_units.py
4751
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
""" This file contains a simple test for the Python bindings to the C++ code (dlls reading, pyd importing etc). """
2+
3+
import pytest
4+
import os
5+
import sys
6+
7+
# Import the C++ bindings
8+
extra_dll_dir = os.path.join(os.path.dirname(__file__), "./")
9+
os.add_dll_directory(extra_dll_dir) # For finding DLL dependencies on Windows
10+
sys.path.append(extra_dll_dir) # Add this directory to the Python path
11+
try:
12+
import diffcheck_bindings as dfb
13+
except ImportError as e:
14+
print(f"Failed to import diffcheck_bindings: {e}")
15+
print("Current sys.path directories:")
16+
for path in sys.path:
17+
print(path)
18+
print("Current files in the directory:")
19+
for file in os.listdir(extra_dll_dir):
20+
print(file)
21+
sys.exit(1)
22+
23+
def test_dfb_test_simple():
24+
assert dfb.dfb_test.test() == True, "The test function should return True"
25+
26+
if __name__ == "__main__":
27+
pytest.main()

tests/integration_tests/pybinds_tests/test_pybind_units.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
print(file)
2020
sys.exit(1)
2121

22-
def test_dfb_test_simple():
23-
assert dfb.dfb_test.test() == True, "The test function should return True"
24-
22+
# getting the test data paths
2523
def debug_directory_contents(path):
2624
print(f"Checking contents of directory: {path}")
2725
if os.path.exists(path):
@@ -30,7 +28,6 @@ def debug_directory_contents(path):
3028
else:
3129
print(f"Directory does not exist: {path}")
3230

33-
# getting the test data paths
3431
def get_ply_cloud_roof_quarter_path():
3532
base_test_data_dir = os.getenv('DF_TEST_DATA_DIR', os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'test_data')))
3633
ply_file_path = os.path.join(base_test_data_dir, "roof_quarter.ply")

0 commit comments

Comments
 (0)