Commit 81126ea8 authored by Johan Ström's avatar Johan Ström

Anoter attempt at test fixes

parent 38cf71a2
Pipeline #442 passed with stage
in 2 minutes and 41 seconds
......@@ -19,5 +19,9 @@ override_dh_auto_configure:
override_dh_auto_build:
dh_auto_build --parallel
# Default runs make test which is very silent in what fails
override_dh_auto_test:
$(MAKE) -j1 check
%:
dh $@ --with python2
......@@ -17,9 +17,9 @@ target_link_libraries (testrunner ${TEST_LIBRARIES})
add_test( cpp-test testrunner )
add_test( python-test ${CMAKE_CURRENT_SOURCE_DIR}/run-pytest.sh -v ${CMAKE_CURRENT_SOURCE_DIR}/python/)
set_tests_properties(python-test PROPERTIES
ENVIRONMENT PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/../python/)
add_test(NAME python-test
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run-pytest.sh -v ${CMAKE_CURRENT_SOURCE_DIR}/python/
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# Shortcut to build and run all tests
add_custom_target(check
......
#!/bin/sh
# This is mainly workaround for cmake 3.0 which does not seem to find pytest in PATH
# so we cannot call it directly from test.
set -e
CMAKE_CURRENT_BINARY_DIR=$(pwd)
# If executed from non-interactive terminal (default when gitlab CI builds)
# we have none or limited PATH. Make sure we get one, or we cannot find pytest
[ -z "$(which pytest)" ] && export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
[ -z "$(which pytest)" ] && exit "pytest binary not found"
# Do not write bytecode, creates problem if running local dev and in-container dev from same source
export PYTHONDONTWRITEBYTECODE=x
# Ensure we can find our python library
export PYTHONPATH=$(dirname ${CMAKE_CURRENT_BINARY_DIR})/python/
# Use explicit cachedir in $(pwd), which should be the build-dir when executed from CMake
pytest -o cache_dir=$(pwd)/.pytest_cache $*
exec pytest -o cache_dir=$(pwd)/.pytest_cache $*
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment