diff options
| author | Jacob Walls <jacobtylerwalls@gmail.com> | 2023-09-04 12:30:49 -0400 |
|---|---|---|
| committer | Natalia <124304+nessita@users.noreply.github.com> | 2023-09-07 15:47:26 -0300 |
| commit | 1ab2cf7994a6f1116a96fbaedd7cadbd4b754179 (patch) | |
| tree | 7a666d9535d0686269d2c5a21a97995e520b633f | |
| parent | 254df3a3bbc2f4df51f9e2070ab2e214553f67d0 (diff) | |
Fixed #34810 -- Measured test coverage on django-admin commands.
| -rw-r--r-- | tests/.coveragerc | 2 | ||||
| -rwxr-xr-x | tests/runtests.py | 4 | ||||
| -rw-r--r-- | tests/sitecustomize.py | 6 |
3 files changed, 11 insertions, 1 deletions
diff --git a/tests/.coveragerc b/tests/.coveragerc index 822e6846a9..f1ec004854 100644 --- a/tests/.coveragerc +++ b/tests/.coveragerc @@ -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 diff --git a/tests/runtests.py b/tests/runtests.py index 7daffed898..2eb7490170 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -71,6 +71,10 @@ tempfile.tempdir = os.environ["TMPDIR"] = TMPDIR # 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. diff --git a/tests/sitecustomize.py b/tests/sitecustomize.py new file mode 100644 index 0000000000..03fbf0c181 --- /dev/null +++ b/tests/sitecustomize.py @@ -0,0 +1,6 @@ +try: + import coverage +except ImportError: + pass +else: + coverage.process_startup() |
