Skip to content

Commit

Permalink
Add pre-test cleanup - fix pyc problems for good
Browse files Browse the repository at this point in the history
  • Loading branch information
ambrussimon committed Jan 22, 2018
1 parent 2b3c18b commit ba51d52
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 12 additions & 1 deletion tests/bin/docker-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions tests/bin/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit ba51d52

Please sign in to comment.