Skip to content

Commit d0bad08

Browse files
authored
CI: Run the 'GMT Tests' workflow on Python 3.10/3.12 with optional packages and Python 3.11 without optional packages (#3618)
- CI: Run the 'GMT Tests' workflow on Python 3.10/3.12 with optional packages and Python 3.11 without optional packages (#3618) - Fix one doctest due to minor changes in xarray repr - string[pyarrow_numpy] was added since pandas 2.1
1 parent 09802b0 commit d0bad08

File tree

3 files changed

+36
-28
lines changed

3 files changed

+36
-28
lines changed

.github/workflows/ci_tests.yaml

+23-24
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
# Test PyGMT on Linux/macOS/Windows
22
#
3-
# This workflow runs regular PyGMT tests and uploads test coverage reports stored
4-
# in `.coverage.xml` to https://app.codecov.io/gh/GenericMappingTools/pygmt
5-
# via the [Codecov GitHub Action](https://github.com/codecov/codecov-action).
6-
# More codecov related configurations are stored in `.github/codecov.yml`.
7-
# If any tests fail, it also uploads the diff images as workflow artifacts.
3+
# This workflow runs regular PyGMT tests and uploads test coverage reports stored in
4+
# `.coverage.xml` to https://app.codecov.io/gh/GenericMappingTools/pygmt via the
5+
# [Codecov GitHub Action](https://github.com/codecov/codecov-action). More codecov
6+
# related configurations are stored in `.github/codecov.yml`. If any tests fail, it also
7+
# uploads the diff images as workflow artifacts.
88
#
99
# It is run:
1010
# 1. on every commit to the main branch
11-
# 2. on every commit to the pull request branches, unless the pull requests only
12-
# contain non-code changes.
11+
# 2. on every commit to the pull request branches, unless the pull requests only contain
12+
# non-code changes.
1313
# 3. when a new release is published
1414
#
1515
# It is also scheduled to run daily on the main branch.
1616
#
17-
# In draft pull request, only two jobs on Linux are triggered to save on
18-
# Continuous Integration resources:
17+
# In draft pull request, only jobs on Linux are triggered to save on Continuous
18+
# Integration resources:
1919
#
20-
# - Minimum supported Python, NumPy, pandas, Xarray versions following [SPEC 0](https://scientific-python.org/specs/spec-0000/)
21-
# - Latest Python, NumPy versions + optional packages (e.g. GeoPandas)
20+
# - Minimum supported Python + core packages (minimum supported versions)
21+
# + optional packages (minimum supported versions if any)
22+
# - Latest Python + core packages (latest versions) + optional packages
23+
# - Last release before the latest Python + core packages
2224
#
2325
name: Tests
2426

@@ -59,35 +61,32 @@ jobs:
5961
# Is it a draft Pull Request (true or false)?
6062
isDraft:
6163
- ${{ github.event.pull_request.draft }}
62-
# Only run two jobs (Ubuntu + Python 3.10/3.12) for draft PRs
64+
# Only run three jobs on Ubuntu for draft PRs
6365
exclude:
6466
- os: macos-latest
6567
isDraft: true
6668
- os: windows-latest
6769
isDraft: true
68-
# Pair Python 3.10 with the minimum supported versions of NumPy, pandas, Xarray
69-
# and Python 3.12 with the latest versions of NumPy, pandas, Xarray
70-
# Only install optional packages on Python 3.12
7170
include:
71+
# Python 3.10 + core packages (minimum supported versions) + optional packages (minimum supported versions if any)
7272
- python-version: '3.10'
7373
numpy-version: '1.24'
7474
pandas-version: '=2.0'
7575
xarray-version: '=2023.04'
76-
optional-packages: ''
76+
optional-packages: ' contextily geopandas<1 ipython pyarrow rioxarray sphinx-gallery'
77+
# Python 3.12 + core packages (latest versions) + optional packages
7778
- python-version: '3.12'
7879
numpy-version: '2.1'
7980
pandas-version: ''
8081
xarray-version: ''
81-
optional-packages: ' contextily geopandas ipython pyarrow rioxarray sphinx-gallery'
82-
# The job below is for testing GeoPandas v0.x on Ubuntu.
83-
# The python-version here can't be the versions in the matrix.python-version
84-
# defined above. Otherwise, other jobs will be overridden by this one.
82+
optional-packages: ' contextily geopandas>=1.0 ipython pyarrow rioxarray sphinx-gallery'
83+
# Python 3.11 + core packages (Linux only)
8584
- os: 'ubuntu-latest'
86-
python-version: '3.11' # Can't be 3.10 or 3.12.
87-
numpy-version: '1.24'
88-
pandas-version: '=2.1'
85+
python-version: '3.11'
86+
numpy-version: ''
87+
pandas-version: ''
8988
xarray-version: ''
90-
optional-packages: ' geopandas<1 pyarrow'
89+
optional-packages: ''
9190

9291
timeout-minutes: 30
9392
defaults:

pygmt/datasets/tile_map.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ def load_tile_map(
119119
Frozen({'band': 3, 'y': 256, 'x': 512})
120120
>>> raster.coords # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
121121
Coordinates:
122-
* band (band) uint8 ... 1 2 3
123-
* y (y) float64 ... -7.081e-10 -7.858e+04 ... -1.996e+07 -2.004e+07
124-
* x (x) float64 ... -2.004e+07 -1.996e+07 ... 1.996e+07 2.004e+07
122+
* band (band) uint8... 1 2 3
123+
* y (y) float64... -7.081e-10 -7.858e+04 ... -1.996e+07 -2.004e+07
124+
* x (x) float64... -2.004e+07 -1.996e+07 ... 1.996e+07 2.004e+07
125125
spatial_ref int... 0
126126
>>> # CRS is set only if rioxarray is available
127127
>>> if hasattr(raster, "rio"):

pygmt/tests/test_clib_to_numpy.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,16 @@ def test_to_numpy_pandas_series_numpy_dtypes_numeric(dtype, expected_dtype):
183183
"U10",
184184
"string[python]",
185185
pytest.param("string[pyarrow]", marks=skip_if_no(package="pyarrow")),
186-
pytest.param("string[pyarrow_numpy]", marks=skip_if_no(package="pyarrow")),
186+
pytest.param(
187+
"string[pyarrow_numpy]",
188+
marks=[
189+
skip_if_no(package="pyarrow"),
190+
pytest.mark.skipif(
191+
Version(pd.__version__) < Version("2.1"),
192+
reason="string[pyarrow_numpy] was added since pandas 2.1",
193+
),
194+
],
195+
),
187196
],
188197
)
189198
def test_to_numpy_pandas_series_pandas_dtypes_string(dtype):

0 commit comments

Comments
 (0)