From a69303ac922604be25f9035852ecfffb773e4424 Mon Sep 17 00:00:00 2001 From: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com> Date: Thu, 19 Sep 2024 20:42:32 +0200 Subject: [PATCH 1/3] Introduce Codecov's Test Analysis --- .github/workflows/unit_tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index fc9925c0806..ba000e32685 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -97,3 +97,9 @@ jobs: name: ${{ matrix.os }}-${{ matrix.python-version }} fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} + - name: Upload test results to Codecov + uses: codecov/test-results-action@v1 + if: ${{ !cancelled() }} + with: + files: .test_report_no_optionals.xml,.test_report_optionals.xml + token: ${{ secrets.CODECOV_TOKEN }} From 71eb5fd82d56079c11fa56101c66ae7ee06086e8 Mon Sep 17 00:00:00 2001 From: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com> Date: Thu, 19 Sep 2024 21:05:22 +0200 Subject: [PATCH 2/3] Try advice from https://docs.codecov.com/docs/test-result-ingestion-beta#troubleshooting --- .github/workflows/unit_tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index ba000e32685..c385c696bec 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -59,7 +59,7 @@ jobs: TO_TEST="test_no_passport.py or test_datetime.py or test_defaults.py or test_jobqueue.py or test_applicationbuilder.py or test_ratelimiter.py or test_updater.py or test_callbackdatacache.py or test_request.py" pytest -v --cov -k "${TO_TEST}" # Rerun only failed tests (--lf), and don't run any tests if none failed (--lfnf=none) - pytest -v --cov --cov-append -k "${TO_TEST}" --lf --lfnf=none --junit-xml=.test_report_no_optionals.xml + pytest -v --cov --cov-append -k "${TO_TEST}" --lf --lfnf=none --junit-xml=.test_report_no_optionals_junit.xml # No tests were selected, convert returned status code to 0 opt_dep_status=$(( $? == 5 ? 0 : $? )) @@ -70,7 +70,7 @@ jobs: # worker. Increasing number of workers has little effect on test duration, but it seems # to increase flakyness, specially on python 3.7 with --dist=loadgroup. pytest -v --cov --cov-append -n auto --dist loadfile - pytest -v --cov --cov-append -n auto --dist loadfile --lf --lfnf=none --junit-xml=.test_report_optionals.xml + pytest -v --cov --cov-append -n auto --dist loadfile --lf --lfnf=none --junit-xml=.test_report_optionals_junit.xml main_status=$(( $? == 5 ? 0 : $? )) # exit with non-zero status if any of the two pytest runs failed exit $(( ${opt_dep_status} || ${main_status} )) @@ -87,8 +87,8 @@ jobs: if: always() # always run, even if tests fail with: paths: | - .test_report_no_optionals.xml - .test_report_optionals.xml + .test_report_no_optionals_junit.xml + .test_report_optionals_junit.xml - name: Submit coverage uses: codecov/codecov-action@v4 @@ -101,5 +101,5 @@ jobs: uses: codecov/test-results-action@v1 if: ${{ !cancelled() }} with: - files: .test_report_no_optionals.xml,.test_report_optionals.xml + files: .test_report_no_optionals_junit.xml,.test_report_optionals_junit.xml token: ${{ secrets.CODECOV_TOKEN }} From 1f2144a790661acb4dff3c1a545e65226728ae58 Mon Sep 17 00:00:00 2001 From: Hinrich Mahler <22366557+Bibo-Joshi@users.noreply.github.com> Date: Thu, 19 Sep 2024 21:41:06 +0200 Subject: [PATCH 3/3] Step back from rerunning failing tests - see #3631 --- .github/workflows/unit_tests.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index c385c696bec..a8acc04a8a2 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -57,11 +57,8 @@ jobs: # - without socks support # - without http2 support TO_TEST="test_no_passport.py or test_datetime.py or test_defaults.py or test_jobqueue.py or test_applicationbuilder.py or test_ratelimiter.py or test_updater.py or test_callbackdatacache.py or test_request.py" - pytest -v --cov -k "${TO_TEST}" - # Rerun only failed tests (--lf), and don't run any tests if none failed (--lfnf=none) - pytest -v --cov --cov-append -k "${TO_TEST}" --lf --lfnf=none --junit-xml=.test_report_no_optionals_junit.xml - # No tests were selected, convert returned status code to 0 - opt_dep_status=$(( $? == 5 ? 0 : $? )) + pytest -v --cov -k "${TO_TEST}" --junit-xml=.test_report_no_optionals_junit.xml + opt_dep_status=$? # Test the rest export TEST_WITH_OPT_DEPS='true' @@ -69,9 +66,8 @@ jobs: # `-n auto --dist loadfile` uses pytest-xdist to run each test file on a different CPU # worker. Increasing number of workers has little effect on test duration, but it seems # to increase flakyness, specially on python 3.7 with --dist=loadgroup. - pytest -v --cov --cov-append -n auto --dist loadfile - pytest -v --cov --cov-append -n auto --dist loadfile --lf --lfnf=none --junit-xml=.test_report_optionals_junit.xml - main_status=$(( $? == 5 ? 0 : $? )) + pytest -v --cov --cov-append -n auto --dist loadfile --junit-xml=.test_report_optionals_junit.xml + main_status=$? # exit with non-zero status if any of the two pytest runs failed exit $(( ${opt_dep_status} || ${main_status} )) env:
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: