From 466bc0db4a4f4875eee242ca63716885c27e319f Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 24 Apr 2024 19:28:02 +0800 Subject: [PATCH 1/8] Add pytest-xdist and pytest-rerunfailures to environment.yml --- environment.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/environment.yml b/environment.yml index 6791196c1e7..ad92914bda9 100644 --- a/environment.yml +++ b/environment.yml @@ -28,10 +28,12 @@ dependencies: - ruff>=0.3.0 # Dev dependencies (unit testing) - matplotlib-base + - pytest>=6.0 - pytest-cov - pytest-doctestplus - pytest-mpl - - pytest>=6.0 + - pytest-rerunfailures + - pytest-xdist # Dev dependencies (building documentation) - myst-parser - panel From 485f9f73d7c4efb0179d35c430c046ce8716d4ce Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 24 Apr 2024 19:28:38 +0800 Subject: [PATCH 2/8] Add pytest-xdist and pytest-rerunfailed to ci_tests.yaml --- .github/workflows/ci_tests.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index cf5d473963f..5649454c5e4 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -125,6 +125,8 @@ jobs: pytest-cov pytest-doctestplus pytest-mpl + pytest-rerunfailures + pytest-xdist # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub From 04f273f310b06576ce39fa4e748586e3caf4c202 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 24 Apr 2024 19:29:05 +0800 Subject: [PATCH 3/8] Add option -n auto --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0b9daf9ab16..5d4a750ff70 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -162,7 +162,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 --durations=0 --durations-min=0.2 --doctest-modules --mpl --mpl-results-path=results -n auto" markers = [ "benchmark: mark a test with custom benchmark settings.", ] From 1a49f0def4bcab358045375b5413d241724552d3 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Wed, 24 Apr 2024 19:43:09 +0800 Subject: [PATCH 4/8] Add option --reruns 5 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 5d4a750ff70..d39c08d7a78 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -162,7 +162,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 -n auto" +addopts = "--verbose --durations=0 --durations-min=0.2 --doctest-modules --mpl --mpl-results-path=results -n auto --reruns 2" markers = [ "benchmark: mark a test with custom benchmark settings.", ] From e98b9a127df58b5c8d9784dfbef07a7aa7d79827 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 28 Apr 2024 15:15:24 +0800 Subject: [PATCH 5/8] Add pytest-xdist and pytest-rerunfailures to other workflows --- .github/workflows/benchmarks.yml | 3 ++- .github/workflows/ci_doctests.yaml | 2 ++ .github/workflows/ci_tests_dev.yaml | 2 +- .github/workflows/ci_tests_legacy.yaml | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index af44301acfd..9c01af4e82a 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -59,7 +59,8 @@ jobs: echo $CONDA/bin >> $GITHUB_PATH conda install --solver=libmamba gmt=6.5.0 python=3.12 \ numpy pandas xarray netCDF4 packaging \ - geopandas pyarrow pytest pytest-mpl + geopandas pyarrow \ + pytest pytest-mpl pytest-rerunfailures pytest-xdist python -m pip install -U pytest-codspeed setuptools # Download cached remote files (artifacts) from GitHub diff --git a/.github/workflows/ci_doctests.yaml b/.github/workflows/ci_doctests.yaml index 0bea2a9a2f5..dda664ef23e 100644 --- a/.github/workflows/ci_doctests.yaml +++ b/.github/workflows/ci_doctests.yaml @@ -68,6 +68,8 @@ jobs: pytest pytest-doctestplus pytest-mpl + pytest-rerunfailures + pytest-xdist # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub diff --git a/.github/workflows/ci_tests_dev.yaml b/.github/workflows/ci_tests_dev.yaml index e57786a4e9c..319b579869d 100644 --- a/.github/workflows/ci_tests_dev.yaml +++ b/.github/workflows/ci_tests_dev.yaml @@ -122,7 +122,7 @@ jobs: --extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \ numpy pandas xarray netCDF4 packaging \ build contextily dvc geopandas ipython pyarrow rioxarray \ - 'pytest>=6.0' pytest-cov pytest-doctestplus pytest-mpl \ + pytest pytest-cov pytest-doctestplus pytest-mpl pytest-rerunfailures pytest-xdist\ sphinx-gallery # Show installed pkg information for postmortem diagnostic diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index 94ed7eec2c9..944904c3313 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -80,6 +80,8 @@ jobs: pytest pytest-doctestplus pytest-mpl + pytest-rerunfailures + pytest-xdist # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub From 83f6d0c300d56573cabcc349efb63801ef4bcbfa Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 10 May 2024 22:47:26 +0800 Subject: [PATCH 6/8] Revert the changes in ci_doctests.yaml and ci_tests_legacy.yaml. --- .github/workflows/ci_doctests.yaml | 2 -- .github/workflows/ci_tests_legacy.yaml | 2 -- 2 files changed, 4 deletions(-) diff --git a/.github/workflows/ci_doctests.yaml b/.github/workflows/ci_doctests.yaml index c3313477295..12763753120 100644 --- a/.github/workflows/ci_doctests.yaml +++ b/.github/workflows/ci_doctests.yaml @@ -68,8 +68,6 @@ jobs: pytest pytest-doctestplus pytest-mpl - pytest-rerunfailures - pytest-xdist # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub diff --git a/.github/workflows/ci_tests_legacy.yaml b/.github/workflows/ci_tests_legacy.yaml index 2e73e89bb4b..a2d6357ef1c 100644 --- a/.github/workflows/ci_tests_legacy.yaml +++ b/.github/workflows/ci_tests_legacy.yaml @@ -80,8 +80,6 @@ jobs: pytest pytest-doctestplus pytest-mpl - pytest-rerunfailures - pytest-xdist # Download cached remote files (artifacts) from GitHub - name: Download remote data from GitHub From 0c6cc85d068149833b82a7eb94c51c8c5e2352fb Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Fri, 10 May 2024 23:27:41 +0800 Subject: [PATCH 7/8] Debug benchmarks --- .github/workflows/benchmarks.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 2c138ded570..14f150d1f79 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -80,7 +80,9 @@ jobs: uses: CodSpeedHQ/action@v2.4.1 with: run: | + ls /usr/share/miniconda/share/proj python -c "import pygmt; pygmt.show_versions()" PYGMT_USE_EXTERNAL_DISPLAY="false" python -m pytest -r P --pyargs pygmt --codspeed env: GMT_LIBRARY_PATH: /usr/share/miniconda/lib/ + PROJ_LIB: /usr/share/miniconda/share/proj From 346e985019afbfaf5624fa6ce4add36eb0a1a034 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sat, 11 May 2024 08:59:36 +0800 Subject: [PATCH 8/8] Update .github/workflows/benchmarks.yml --- .github/workflows/benchmarks.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 14f150d1f79..4b10d546a4b 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -80,7 +80,6 @@ jobs: uses: CodSpeedHQ/action@v2.4.1 with: run: | - ls /usr/share/miniconda/share/proj python -c "import pygmt; pygmt.show_versions()" PYGMT_USE_EXTERNAL_DISPLAY="false" python -m pytest -r P --pyargs pygmt --codspeed env: