Skip to content

Commit

Permalink
Fixed #34810 -- Measured test coverage on django-admin commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls authored and nessita committed Sep 7, 2023
1 parent 254df3a commit 1ab2cf7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/.coveragerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[run]
branch = True
concurrency = multiprocessing,thread
data_file = .coverages/.coverage
data_file = ${RUNTESTS_DIR-.}/.coverages/.coverage
omit =
*/django/utils/autoreload.py
source = django
Expand Down
4 changes: 4 additions & 0 deletions tests/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
# Removing the temporary TMPDIR.
atexit.register(shutil.rmtree, TMPDIR)

# Add variables enabling coverage to trace code in subprocesses.
os.environ["RUNTESTS_DIR"] = RUNTESTS_DIR
os.environ["COVERAGE_PROCESS_START"] = os.path.join(RUNTESTS_DIR, ".coveragerc")


# This is a dict mapping RUNTESTS_DIR subdirectory to subdirectories of that
# directory to skip when searching for test modules.
Expand Down
6 changes: 6 additions & 0 deletions tests/sitecustomize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
try:
import coverage
except ImportError:
pass
else:
coverage.process_startup()

0 comments on commit 1ab2cf7

Please sign in to comment.