Python: Fix test requires, run build by default
Vicki Pfau vi@endrift.com
Sat, 12 Aug 2017 18:35:17 -0700
2 files changed,
5 insertions(+),
3 deletions(-)
M
src/platform/python/CMakeLists.txt
→
src/platform/python/CMakeLists.txt
@@ -34,11 +34,13 @@ set_target_properties(${BINARY_NAME}-pylib PROPERTIES INCLUDE_DIRECTORIES "${CMAKE_BINARY_DIR};${INCLUDE_DIRECTORIES}")
set_target_properties(${BINARY_NAME}-pylib PROPERTIES COMPILE_DEFINITIONS "${OS_DEFINES};${FEATURE_DEFINES};${FUNCTION_DEFINES}") set(PYTHON_LIBRARY ${BINARY_NAME}-pylib PARENT_SCOPE) -add_custom_target(${BINARY_NAME}-py ALL DEPENDS ${BINARY_NAME}-pylib ${CMAKE_CURRENT_BINARY_DIR}/build/lib/${BINARY_NAME}/__init__.py) +add_custom_target(${BINARY_NAME}-py ALL + COMMAND ${PYTHON} ${CMAKE_CURRENT_BINARY_DIR}/setup.py build + DEPENDS ${BINARY_NAME}-pylib ${CMAKE_CURRENT_BINARY_DIR}/build/lib/${BINARY_NAME}/__init__.py) file(GLOB TESTS ${CMAKE_CURRENT_SOURCE_DIR}/test_*.py) foreach(TEST IN LISTS TESTS) string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/test_" "" TEST_NAME "${TEST}") string(REPLACE ".py" "" TEST_NAME "${TEST_NAME}") - add_test(python-${TEST_NAME} pytest ${TEST}) + add_test(python-${TEST_NAME} ${PYTHON} ${CMAKE_CURRENT_BINARY_DIR}/setup.py pytest --addopts ${TEST}) endforeach()
M
src/platform/python/setup.py.in
→
src/platform/python/setup.py.in
@@ -25,7 +25,7 @@ packages=["mgba"],
setup_requires=['cffi>=1.6', 'pytest-runner'], install_requires=['cffi>=1.6', 'cached-property'], extras_require={'pil': ['Pillow>=2.3'], 'cinema': ['pyyaml', 'pytest']}, - tests_require=['mgba[cinema]', 'pytest'], + tests_require=['Pillow>=2.3', 'pyyaml', 'pytest'], cffi_modules=["_builder.py:ffi"], license="MPL 2.0", classifiers=classifiers