Skip to content

Commit 3a8bedf

Browse files
committed
meta: make test target require python interpreter
1 parent 8457800 commit 3a8bedf

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ else ()
9191
include_directories(INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/nbtp/include)
9292
endif ()
9393

94+
# Test time dependencies
95+
if (BUILD_TESTS)
96+
find_package(Python REQUIRED COMPONENTS Interpreter)
97+
endif ()
98+
9499
# Resources
95100
add_subdirectory(misc)
96101

src/CMakeLists.txt

+6-5
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ if (USE_GETTEXT)
4646
target_include_directories(libminemap PUBLIC ${Intl_INCLUDE_DIRS})
4747
if (NOT Intl_IS_BUILT_IN)
4848
target_link_libraries(libminemap PUBLIC ${Intl_LIBRARY})
49-
endif()
50-
endif()
49+
endif ()
50+
endif ()
5151

5252
foreach (PROGRAM IN LISTS PROGRAMS)
5353
add_executable(${PROGRAM} ${PROGRAM}.cpp)
@@ -69,11 +69,12 @@ add_subdirectory(tests)
6969
if (BUILD_TESTS)
7070
find_package(Python3 COMPONENTS Interpreter REQUIRED)
7171
file(GLOB TEST_FIXURES LIST_DIRECTORIES false "${CMAKE_CURRENT_SOURCE_DIR}/../test-images/*.json")
72-
foreach(TEST_FIXURE IN LISTS TEST_FIXURES)
72+
foreach (TEST_FIXURE IN LISTS TEST_FIXURES)
7373
if ("${TEST_FIXURE}" MATCHES "([^/]+)\\.json")
7474
add_test(NAME "${CMAKE_MATCH_1}"
75-
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../test-images/verify.py" "$<TARGET_FILE:minemap>" "${TEST_FIXURE}"
75+
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../test-images/verify.py" "$<TARGET_FILE:minemap>" "${TEST_FIXURE}"
76+
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../test-images"
7677
)
7778
endif ()
78-
endforeach()
79+
endforeach ()
7980
endif ()

test-images/apt2.nbt

-16.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)