From 7bc3795d450844c7bb55f502042845e282b4fb59 Mon Sep 17 00:00:00 2001 From: lrjball <50599110+lrjball@users.noreply.github.com> Date: Sat, 2 May 2020 02:12:28 +0100 Subject: [PATCH 1/6] Updated coverage.yml to better report coverage stats Currently modules which are imported early are misreported in coverage. This has a fix which is documented in the dev guide, but the fix isn't being used in the CI. This PR adds in that fix. --- .github/workflows/coverage.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 75bdf83f6c5dbb..4af4277ce5b90c 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -52,7 +52,9 @@ jobs: - name: 'Tests with coverage' run: > source ./.venv/bin/activate && - xvfb-run python -m coverage + xvfb-run + PYTHONPATH=.venv/lib/python*/site-packages/coverage/fullcoverage + python -m coverage run --branch --pylib -m test --fail-env-changed From 653165cb2d81b452b7293aae60e9174e52bb4dd5 Mon Sep 17 00:00:00 2001 From: lrjball <50599110+lrjball@users.noreply.github.com> Date: Sat, 2 May 2020 02:39:47 +0100 Subject: [PATCH 2/6] Updated travis.yml as well --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3c2fb4bdc78755..36e8bc3b712c3f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -90,7 +90,7 @@ matrix: - ./venv/bin/python -m test.pythoninfo script: # Skip tests that re-run the entire test suite. - - xvfb-run ./venv/bin/python -m coverage run --branch --pylib -m test --fail-env-changed -uall,-cpu -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn -x test_concurrent_futures || true + - xvfb-run PYTHONPATH=.venv/lib/python*/site-packages/coverage/fullcoverage ./venv/bin/python -m coverage run --branch --pylib -m test --fail-env-changed -uall,-cpu -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn -x test_concurrent_futures || true after_script: # Probably should be after_success once test suite updated to run under coverage.py. # Make the `coverage` command available to Codecov w/ a version of Python that can parse all source files. - source ./venv/bin/activate From 0a674f78451b63dd12df53ce7ea6801e0664972e Mon Sep 17 00:00:00 2001 From: lrjball <50599110+lrjball@users.noreply.github.com> Date: Sat, 2 May 2020 11:43:49 +0100 Subject: [PATCH 3/6] Updated travis.yml as path not found --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 36e8bc3b712c3f..62bd69fc464ee9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,9 +88,10 @@ matrix: - ./python -m venv venv - ./venv/bin/python -m pip install -U coverage - ./venv/bin/python -m test.pythoninfo + - PYTHONPATH=.venv/lib/python*/site-packages/coverage/fullcoverage script: # Skip tests that re-run the entire test suite. - - xvfb-run PYTHONPATH=.venv/lib/python*/site-packages/coverage/fullcoverage ./venv/bin/python -m coverage run --branch --pylib -m test --fail-env-changed -uall,-cpu -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn -x test_concurrent_futures || true + - xvfb-run ./venv/bin/python -m coverage run --branch --pylib -m test --fail-env-changed -uall,-cpu -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn -x test_concurrent_futures || true after_script: # Probably should be after_success once test suite updated to run under coverage.py. # Make the `coverage` command available to Codecov w/ a version of Python that can parse all source files. - source ./venv/bin/activate From 982d978e8c6d2a8c19797cdbebaccb0e0004e3ec Mon Sep 17 00:00:00 2001 From: lrjball <50599110+lrjball@users.noreply.github.com> Date: Sat, 2 May 2020 14:16:13 +0100 Subject: [PATCH 4/6] fixed typos --- .github/workflows/coverage.yml | 5 ++--- .travis.yml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 4af4277ce5b90c..d3fdae55396eaa 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -49,12 +49,11 @@ jobs: source ./.venv/bin/activate python -m pip install -U coverage python -m test.pythoninfo + export PYTHONPATH=./.venv/lib/python3.9/site-packages/coverage/fullcoverage - name: 'Tests with coverage' run: > source ./.venv/bin/activate && - xvfb-run - PYTHONPATH=.venv/lib/python*/site-packages/coverage/fullcoverage - python -m coverage + xvfb-run python -m coverage run --branch --pylib -m test --fail-env-changed diff --git a/.travis.yml b/.travis.yml index 62bd69fc464ee9..532bd6d4d54c1f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,7 +88,7 @@ matrix: - ./python -m venv venv - ./venv/bin/python -m pip install -U coverage - ./venv/bin/python -m test.pythoninfo - - PYTHONPATH=.venv/lib/python*/site-packages/coverage/fullcoverage + - export PYTHONPATH=./venv/lib/python3.9/site-packages/coverage/fullcoverage script: # Skip tests that re-run the entire test suite. - xvfb-run ./venv/bin/python -m coverage run --branch --pylib -m test --fail-env-changed -uall,-cpu -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn -x test_concurrent_futures || true From 64d521b5d34c25b83d0472608d1eab3a6334bf59 Mon Sep 17 00:00:00 2001 From: lrjball <50599110+lrjball@users.noreply.github.com> Date: Sat, 2 May 2020 16:56:56 +0100 Subject: [PATCH 5/6] Removed PYTHONPATH after test run to prevent memoryerror when xml generated --- .github/workflows/coverage.yml | 1 + .travis.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index d3fdae55396eaa..7b42668f618efc 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -65,6 +65,7 @@ jobs: || true - name: 'Publish code coverage results' run: | + export PYTHONPATH= source ./.venv/bin/activate bash <(curl -s https://codecov.io/bash) -y .github/codecov.yml env: diff --git a/.travis.yml b/.travis.yml index 532bd6d4d54c1f..9a17160747ef00 100644 --- a/.travis.yml +++ b/.travis.yml @@ -94,6 +94,7 @@ matrix: - xvfb-run ./venv/bin/python -m coverage run --branch --pylib -m test --fail-env-changed -uall,-cpu -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn -x test_concurrent_futures || true after_script: # Probably should be after_success once test suite updated to run under coverage.py. # Make the `coverage` command available to Codecov w/ a version of Python that can parse all source files. + - export PYTHONPATH= - source ./venv/bin/activate - bash <(curl -s https://codecov.io/bash) -y .github/codecov.yml - name: "Test code coverage (C)" From 78ed5ede13de143a2e74087df4e63bdf80a89d74 Mon Sep 17 00:00:00 2001 From: lrjball Date: Thu, 14 May 2020 22:36:15 +0100 Subject: [PATCH 6/6] updated PYTHONPATH to avoid hardcoding python version --- .github/workflows/coverage.yml | 2 +- .travis.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 7b42668f618efc..38f8cb336b0588 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -49,7 +49,7 @@ jobs: source ./.venv/bin/activate python -m pip install -U coverage python -m test.pythoninfo - export PYTHONPATH=./.venv/lib/python3.9/site-packages/coverage/fullcoverage + export PYTHONPATH=`find .venv -name fullcoverage` - name: 'Tests with coverage' run: > source ./.venv/bin/activate && diff --git a/.travis.yml b/.travis.yml index 9a17160747ef00..da2cb3343250e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,7 +88,7 @@ matrix: - ./python -m venv venv - ./venv/bin/python -m pip install -U coverage - ./venv/bin/python -m test.pythoninfo - - export PYTHONPATH=./venv/lib/python3.9/site-packages/coverage/fullcoverage + - export PYTHONPATH=`find venv -name fullcoverage` script: # Skip tests that re-run the entire test suite. - xvfb-run ./venv/bin/python -m coverage run --branch --pylib -m test --fail-env-changed -uall,-cpu -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn -x test_concurrent_futures || true