diff --git a/tests/bin/docker-tests.sh b/tests/bin/docker-tests.sh index 7589ff792..eff259574 100755 --- a/tests/bin/docker-tests.sh +++ b/tests/bin/docker-tests.sh @@ -67,6 +67,18 @@ main() { local SCITRAN_CORE_DRONE_SECRET="secret" + # Clean dev/test artifacts like pyc files and coverage reports + # Run within container to avoid permission problems + docker run --rm \ + --name core-test-cleanup \ + --volume $(pwd):/src/core \ + scitran/core:testing \ + sh -c ' + find . -type d -name __pycache__ -exec rm -rf {}\;; + find . -type f -name "*.pyc" -delete; + rm -rf .coverage htmlcov; + ' + # Launch core + mongo docker run -d \ --name core-test-service \ @@ -114,7 +126,6 @@ clean_up() { --volume $(pwd):/src/core \ scitran/core:testing \ sh -c ' - rm -rf .coverage htmlcov; coverage combine; coverage report --skip-covered --show-missing; coverage html; diff --git a/tests/bin/tests.sh b/tests/bin/tests.sh index 55538d2cc..7c7607562 100755 --- a/tests/bin/tests.sh +++ b/tests/bin/tests.sh @@ -33,6 +33,7 @@ Envvars (required for integration tests): main() { + export PYTHONDONTWRITEBYTECODE=1 export RUN_ALL=true local RUN_LINT=false local RUN_UNIT=false @@ -94,12 +95,12 @@ main() { if ${RUN_UNIT}; then log "Running unit tests ..." rm -f .coverage - PYTHONDONTWRITEBYTECODE=1 py.test --cov=api --cov-report= tests/unit_tests/python $PYTEST_ARGS + py.test --cov=api --cov-report= tests/unit_tests/python $PYTEST_ARGS fi if ${RUN_INTEG}; then log "Running integration tests ..." - PYTHONDONTWRITEBYTECODE=1 py.test tests/integration_tests/python $PYTEST_ARGS + py.test tests/integration_tests/python $PYTEST_ARGS fi }