diff options
-rw-r--r-- | .github/workflows/coverage.yml | 12 | ||||
-rw-r--r-- | igor.py | 5 | ||||
-rw-r--r-- | metacov.ini | 6 |
3 files changed, 10 insertions, 13 deletions
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index f8aca5cb..7b61deda 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -70,22 +70,13 @@ jobs: - name: "Run tox coverage for ${{ matrix.python-version }}" env: COVERAGE_COVERAGE: "yes" + COVERAGE_CONTEXT: "${{ matrix.python-version }}.${{ matrix.os }}" run: | set -xe # Something about pytest 6.x with xdist keeps data from collecting. # Use -n0 for now. python -m tox -- -n 0 - - name: "Combine" - env: - COVERAGE_COVERAGE: "yes" - COVERAGE_RCFILE: "metacov.ini" - COVERAGE_METAFILE: ".metacov" - run: | - set -xe - COVERAGE_DEBUG=dataio python -m igor combine_html - mv .metacov .metacov.${{ matrix.python-version }}.${{ matrix.os }} - - name: "Upload coverage data" uses: actions/upload-artifact@v2 with: @@ -126,6 +117,7 @@ jobs: env: COVERAGE_RCFILE: "metacov.ini" COVERAGE_METAFILE: ".metacov" + COVERAGE_CONTEXT: "yes" run: | set -xe python -m igor combine_html @@ -135,6 +135,9 @@ def run_tests_with_coverage(tracer, *runner_args): os.environ['COVERAGE_TESTING'] = "True" os.environ['COVERAGE_PROCESS_START'] = os.path.abspath('metacov.ini') os.environ['COVERAGE_HOME'] = os.getcwd() + context = os.environ.get('COVERAGE_CONTEXT') + if context: + os.environ['COVERAGE_CONTEXT'] = context + "." + tracer # Create the .pth file that will let us measure coverage in sub-processes. # The .pth file seems to have to be alphabetically after easy-install.pth @@ -192,7 +195,7 @@ def do_combine_html(): cov.load() cov.combine() cov.save() - show_contexts = bool(os.environ.get('COVERAGE_CONTEXT')) + show_contexts = bool(os.environ.get('COVERAGE_DYNCTX') or os.environ.get('COVERAGE_CONTEXT')) cov.html_report(show_contexts=show_contexts) cov.xml_report() diff --git a/metacov.ini b/metacov.ini index 9dab77aa..209c1212 100644 --- a/metacov.ini +++ b/metacov.ini @@ -13,8 +13,10 @@ parallel = true source = ${COVERAGE_HOME-.}/coverage ${COVERAGE_HOME-.}/tests -# $set_env.py: COVERAGE_CONTEXT - Set to 'test_function' for who-tests-what -dynamic_context = ${COVERAGE_CONTEXT-none} +# $set_env.py: COVERAGE_DYNCTX - Set to 'test_function' for who-tests-what +dynamic_context = ${COVERAGE_DYNCTX-none} +# $set_env.py: COVERAGE_CONTEXT - Set to a static context for this run +context = ${COVERAGE_CONTEXT-none} [report] # We set a different pragmas so our code won't be confused with test code, and |