Skip to content

Commit ba51d52

Browse files
committed
Add pre-test cleanup - fix pyc problems for good
1 parent 2b3c18b commit ba51d52

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

tests/bin/docker-tests.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ main() {
6767

6868
local SCITRAN_CORE_DRONE_SECRET="secret"
6969

70+
# Clean dev/test artifacts like pyc files and coverage reports
71+
# Run within container to avoid permission problems
72+
docker run --rm \
73+
--name core-test-cleanup \
74+
--volume $(pwd):/src/core \
75+
scitran/core:testing \
76+
sh -c '
77+
find . -type d -name __pycache__ -exec rm -rf {}\;;
78+
find . -type f -name "*.pyc" -delete;
79+
rm -rf .coverage htmlcov;
80+
'
81+
7082
# Launch core + mongo
7183
docker run -d \
7284
--name core-test-service \
@@ -114,7 +126,6 @@ clean_up() {
114126
--volume $(pwd):/src/core \
115127
scitran/core:testing \
116128
sh -c '
117-
rm -rf .coverage htmlcov;
118129
coverage combine;
119130
coverage report --skip-covered --show-missing;
120131
coverage html;

tests/bin/tests.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Envvars (required for integration tests):
3333

3434

3535
main() {
36+
export PYTHONDONTWRITEBYTECODE=1
3637
export RUN_ALL=true
3738
local RUN_LINT=false
3839
local RUN_UNIT=false
@@ -94,12 +95,12 @@ main() {
9495
if ${RUN_UNIT}; then
9596
log "Running unit tests ..."
9697
rm -f .coverage
97-
PYTHONDONTWRITEBYTECODE=1 py.test --cov=api --cov-report= tests/unit_tests/python $PYTEST_ARGS
98+
py.test --cov=api --cov-report= tests/unit_tests/python $PYTEST_ARGS
9899
fi
99100

100101
if ${RUN_INTEG}; then
101102
log "Running integration tests ..."
102-
PYTHONDONTWRITEBYTECODE=1 py.test tests/integration_tests/python $PYTEST_ARGS
103+
py.test tests/integration_tests/python $PYTEST_ARGS
103104
fi
104105
}
105106

0 commit comments

Comments
 (0)