Skip to content

Commit

Permalink
Get rid of coverage database access errors
Browse files Browse the repository at this point in the history
This should get rid of all the intermittent access errors from
coverage. These are mainly due to the fact that certain subprocesses
during test setup (such as database initialization inside test
container) will run as root or other users that do not have write access
to the source root directory.

This points coverage to use a coverage database file in the reports
directory, and ensures this is world-writeable (!) so all subprocesses
can access it.
  • Loading branch information
lunkwill42 committed Jan 3, 2023
1 parent c2b9dd3 commit 41b1a6f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ setenv =
BUILDDIR = {envdir}
CHROME_BIN = /usr/bin/google-chrome
DJANGO_SETTINGS_MODULE = nav.django.settings
COVERAGE_FILE = {toxinidir}/reports/coverage/.coverage
PYTHONFAULTHANDLER=1
django32: DJANGO_VER=32
django40: DJANGO_VER=40
Expand All @@ -41,10 +42,14 @@ allowlist_externals =
sh
sed
mkdir
chmod

commands_pre =
pip-compile --resolver=backtracking --output-file {envdir}/requirements.txt tests/requirements.txt requirements/base.txt requirements/optional.txt requirements/django{env:DJANGO_VER}.txt
pip-sync {envdir}/requirements.txt
pip install -e .
mkdir -p {toxinidir}/reports/coverage
chmod 777 {toxinidir}/reports/coverage

commands =
unit: pytest -o junit_suite_name="{envname} unit tests" --cov-config {toxinidir}/tests/.coveragerc --cov={toxinidir}/python --cov-report=xml:reports/{envname}/coverage.xml --junitxml=reports/{envname}/unit-results.xml --verbose {posargs:tests/unittests}
Expand Down

0 comments on commit 41b1a6f

Please sign in to comment.