From 9e0eadae3069937233de459264d267de6567d6b6 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 16 Jul 2024 15:00:23 +1200 Subject: [PATCH 1/3] CI: Show color output on pytest logs in GitHub Actions GitHub Actions does not show colour outputs for pytest by default (https://github.com/pytest-dev/pytest/issues/7443), but it can be enabled using `--color=yes` flag. --- .github/workflows/ci_tests.yaml | 2 +- .github/workflows/ci_tests_dev.yaml | 2 +- .github/workflows/ci_tests_legacy.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 362c8c5df76..1712d6726fe 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -157,7 +157,7 @@ jobs: # Run the regular tests - name: Run tests - run: make test PYTEST_EXTRA="-r P -n auto --reruns 2" + run: make test PYTEST_EXTRA="-r P -n auto --reruns 2 --color=yes" # Upload diff images on test failure - name: Upload diff images if any test fails diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index eeeafe93118..caab8c76642 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -173,7 +173,7 @@ jobs: # Run the tests - name: Test with pytest - run: make test PYTEST_EXTRA="-r P -n auto --reruns 2" + run: make test PYTEST_EXTRA="-r P -n auto --reruns 2 --color=yes" env: GMT_LIBRARY_PATH: ${{ runner.temp }}/gmt-install-dir/lib diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index ef8efc6e4fe..ff42aa2aef6 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -100,4 +100,4 @@ jobs: # Run the tests but skip images - name: Run tests - run: make test_no_images PYTEST_EXTRA="-r P" + run: make test_no_images PYTEST_EXTRA="-r P --color=yes" From 8d3ff65c9900e0fc4c3018a135201c189e478da8 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 16 Jul 2024 15:27:42 +1200 Subject: [PATCH 2/3] Set --color=yes flag in ci_doctests.yaml --- .github/workflows/ci_doctests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_doctests.yaml b/.github/workflows/ci_doctests.yaml index 45bdcb47311..1732b3df5bf 100644 --- a/.github/workflows/ci_doctests.yaml +++ b/.github/workflows/ci_doctests.yaml @@ -86,4 +86,4 @@ jobs: # Run the doctests - name: Run doctests - run: make doctest PYTEST_EXTRA="-r P" + run: make doctest PYTEST_EXTRA="-r P --color=yes" From 24464f635eea4442be4c6b67b83b901cb79a9e49 Mon Sep 17 00:00:00 2001 From: Wei Ji <23487320+weiji14@users.noreply.github.com> Date: Tue, 16 Jul 2024 16:05:14 +1200 Subject: [PATCH 3/3] Set --color=yes in addopts rather than GitHub Actions workflow --- .github/workflows/ci_doctests.yaml | 2 +- .github/workflows/ci_tests.yaml | 2 +- .github/workflows/ci_tests_dev.yaml | 2 +- .github/workflows/ci_tests_legacy.yaml | 2 +- pyproject.toml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_doctests.yaml b/.github/workflows/ci_doctests.yaml index 1732b3df5bf..45bdcb47311 100644 --- a/.github/workflows/ci_doctests.yaml +++ b/.github/workflows/ci_doctests.yaml @@ -86,4 +86,4 @@ jobs: # Run the doctests - name: Run doctests - run: make doctest PYTEST_EXTRA="-r P --color=yes" + run: make doctest PYTEST_EXTRA="-r P" diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 1712d6726fe..362c8c5df76 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -157,7 +157,7 @@ jobs: # Run the regular tests - name: Run tests - run: make test PYTEST_EXTRA="-r P -n auto --reruns 2 --color=yes" + run: make test PYTEST_EXTRA="-r P -n auto --reruns 2" # Upload diff images on test failure - name: Upload diff images if any test fails diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index caab8c76642..eeeafe93118 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -173,7 +173,7 @@ jobs: # Run the tests - name: Test with pytest - run: make test PYTEST_EXTRA="-r P -n auto --reruns 2 --color=yes" + run: make test PYTEST_EXTRA="-r P -n auto --reruns 2" env: GMT_LIBRARY_PATH: ${{ runner.temp }}/gmt-install-dir/lib diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index ff42aa2aef6..ef8efc6e4fe 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -100,4 +100,4 @@ jobs: # Run the tests but skip images - name: Run tests - run: make test_no_images PYTEST_EXTRA="-r P --color=yes" + run: make test_no_images PYTEST_EXTRA="-r P" diff --git a/pyproject.toml b/pyproject.toml index 98637f1f8b6..e61ec4bd818 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -166,7 +166,7 @@ max-args=10 [tool.pytest.ini_options] minversion = "6.0" -addopts = "--verbose --durations=0 --durations-min=0.2 --doctest-modules --mpl --mpl-results-path=results" +addopts = "--verbose --color=yes --durations=0 --durations-min=0.2 --doctest-modules --mpl --mpl-results-path=results" markers = [ "benchmark: mark a test with custom benchmark settings.", ]