File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 python :
1818 name : Build g2opy
1919 runs-on : ubuntu-latest
20+ env :
21+ G2O_CACHE_BUILD : true
2022 steps :
2123 - uses : actions/checkout@v4
2224 with :
2729 sudo apt install libeigen3-dev libspdlog-dev nlohmann-json3-dev
2830 - name : Build
2931 run : pipx run build
32+ - name : Run tests
33+ run : /tmp/g2opy/pytest_helper.sh
3034
3135 build :
3236 name : ${{ matrix.config.name }}
Original file line number Diff line number Diff line change @@ -77,3 +77,11 @@ target_link_libraries(g2opy PRIVATE
7777)
7878target_include_directories (g2opy PRIVATE ${CMAKE_CURRENT_SOURCE_DIR } )
7979install (TARGETS g2opy LIBRARY DESTINATION g2opy)
80+
81+ #Write pytest helper script to build folder
82+ file (WRITE "${CMAKE_BINARY_DIR } /pytest_helper.sh" "#!/bin/sh
83+ set -e
84+ export G2O_LIB_DIR=\" ${g2o_LIBRARY_OUTPUT_DIRECTORY} \"
85+ exec pytest \" ${CMAKE_CURRENT_SOURCE_DIR } \"
86+ " )
87+ file (CHMOD "${CMAKE_BINARY_DIR } /pytest_helper.sh" PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ )
Original file line number Diff line number Diff line change 11[pytest]
2- testpaths = python/ tests
2+ testpaths = tests
33python_files = test_*.py
44python_classes = Test*
55python_functions = test_*
Original file line number Diff line number Diff line change 11"""Pytest fixtures for g2o Python bindings tests."""
22
3+ import os
34import sys
45import tempfile
56from pathlib import Path
67
7- # Ensure build lib is in path BEFORE any imports - this is critical
8- build_lib_path = Path ( __file__ ). resolve (). parent . parent . parent / "build" / "lib"
9- build_lib_str = str (build_lib_path )
10- if build_lib_str not in sys . path :
11- sys .path .insert (0 , build_lib_str )
8+ # Ensure build lib is in path BEFORE any imports
9+ build_lib_dir = os . environ . get (
10+ "G2O_LIB_DIR" , str (Path ( __file__ ). resolve (). parent . parent . parent / "build" / "lib" )
11+ )
12+ sys .path .insert (0 , build_lib_dir )
1213
1314# This must come after path setup
1415import g2opy as g2o
You can’t perform that action at this time.
0 commit comments