Skip to content

Commit bab9723

Browse files
authored
Merge pull request #38 from astrofrog/fix-pytest-72
Updated continuous integration
2 parents 16dfa20 + 754a8bd commit bab9723

File tree

6 files changed

+54
-99
lines changed

6 files changed

+54
-99
lines changed

.github/workflows/ci_workflows.yml

Lines changed: 29 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,34 @@ on:
77
# Run every Sunday at 06:53 UTC
88
- cron: 53 6 * * 0
99

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
1014
jobs:
1115
tests:
12-
runs-on: ${{ matrix.os }}
13-
strategy:
14-
fail-fast: false
15-
matrix:
16-
include:
17-
- os: ubuntu-latest
18-
python-version: 3.7
19-
toxenv: py37-test-pytest46
20-
- os: windows-latest
21-
python-version: 3.7
22-
toxenv: py37-test-pytest50
23-
- os: macos-latest
24-
python-version: 3.8
25-
toxenv: py38-test-pytest52
26-
- os: ubuntu-latest
27-
python-version: 3.8
28-
toxenv: py38-test-pytest53
29-
- os: windows-latest
30-
python-version: 3.9
31-
toxenv: py39-test-pytest60
32-
- os: macos-latest
33-
python-version: 3.9
34-
toxenv: py39-test-pytest61
35-
- os: ubuntu-latest
36-
python-version: '3.10'
37-
toxenv: py310-test-pytest62
38-
- os: ubuntu-latest
39-
python-version: '3.10'
40-
toxenv: py310-test-pytestdev
41-
42-
steps:
43-
- uses: actions/checkout@v2
44-
with:
45-
fetch-depth: 0
46-
- name: Set up Python ${{ matrix.python-version }}
47-
uses: actions/setup-python@v2
48-
with:
49-
python-version: ${{ matrix.python-version }}
50-
- name: Install tox
51-
run: python -m pip install tox
52-
- name: Run tox
53-
run: tox -v -e ${{ matrix.toxenv }}
16+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
17+
with:
18+
envs: |
19+
- linux: codestyle
20+
- linux: py37-test-pytestoldest
21+
- macos: py37-test-pytest50
22+
- windows: py38-test-pytest52
23+
- linux: py38-test-pytest53
24+
- macos: py39-test-pytest60
25+
- windows: py39-test-pytest61
26+
- linux: py310-test-pytest62
27+
- macos: py310-test-pytest70
28+
- windows: py310-test-pytest71
29+
- linux: py311-test-pytest72
30+
- macos: py311-test-pytest73
31+
- windows: py312-test-pytest74
32+
- linux: py312-test-devdeps
33+
publish:
34+
needs: tests
35+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v1
36+
with:
37+
test_extras: test
38+
test_command: pytest $GITHUB_WORKSPACE/tests; pytest --arraydiff $GITHUB_WORKSPACE/tests
39+
secrets:
40+
pypi_token: ${{ secrets.pypi_password }}

.github/workflows/publish.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.

pytest_arraydiff/plugin.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@
2828
#
2929
# https://github.com/astrofrog/pytest-mpl
3030

31-
32-
from functools import wraps
33-
3431
import os
3532
import abc
3633
import shutil
@@ -149,9 +146,9 @@ def read(filename):
149146

150147
@staticmethod
151148
def write(filename, data, **kwargs):
152-
import pandas as pd
149+
import pandas as pd # noqa: F401
153150
key = os.path.basename(filename).replace('.h5', '')
154-
return data.to_hdf(filename, key, **kwargs)
151+
return data.to_hdf(filename, key=key, **kwargs)
155152

156153
@classmethod
157154
def compare(cls, reference_file, test_file, atol=None, rtol=None):
@@ -201,7 +198,7 @@ def pytest_addoption(parser):
201198
def pytest_configure(config):
202199
config.getini('markers').append(
203200
'array_compare: for functions using array comparison')
204-
201+
205202
if config.getoption("--arraydiff") or config.getoption("--arraydiff-generate-path") is not None:
206203

207204
reference_dir = config.getoption("--arraydiff-reference-path")

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ classifiers =
1616
Programming Language :: Python :: 3.8
1717
Programming Language :: Python :: 3.9
1818
Programming Language :: Python :: 3.10
19+
Programming Language :: Python :: 3.11
20+
Programming Language :: Python :: 3.12
1921
Programming Language :: Python :: Implementation :: CPython
2022
Topic :: Software Development :: Testing
2123
Topic :: Utilities

tests/test_pytest_arraydiff.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
import pytest
66
import numpy as np
7+
from packaging.version import Version
8+
9+
NUMPY_LT_2_0 = Version(np.__version__) < Version("2.0.dev")
710

811
reference_dir = 'baseline'
912

@@ -18,6 +21,7 @@ def test_succeeds_func_text():
1821
return np.arange(3 * 5).reshape((3, 5))
1922

2023

24+
@pytest.mark.skipif(not NUMPY_LT_2_0, reason="AttributeError: `np.unicode_` was removed in the NumPy 2.0 release. Use `np.str_` instead.")
2125
@pytest.mark.array_compare(file_format='pd_hdf', reference_dir=reference_dir)
2226
def test_succeeds_func_pdhdf():
2327
pd = pytest.importorskip('pandas')

tox.ini

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
envlist =
3-
py{37,38,39,310}-test{,-devdeps}
3+
py{37,38,39,310,311,312}-test{,-pytestoldest,-pytest50,-pytest52,-pytest53,-pytest60,-pytest61,-pytest62,-pytest70,-pytest71,-pytest72,-pytest73,-pytest74,-devdeps}
44
codestyle
55
requires =
66
setuptools >= 30.3.0
@@ -9,25 +9,38 @@ isolated_build = true
99

1010
[testenv]
1111
changedir = .tmp/{envname}
12+
setenv =
13+
devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
1214
description = run tests
1315
deps =
14-
pytest46: pytest==4.6.*
16+
pytestoldest: pytest==4.6.0
1517
pytest50: pytest==5.0.*
1618
pytest52: pytest==5.2.*
1719
pytest53: pytest==5.3.*
1820
pytest60: pytest==6.0.*
1921
pytest61: pytest==6.1.*
2022
pytest62: pytest==6.2.*
21-
pytestdev: git+https://github.com/pytest-dev/pytest#egg=pytest
23+
pytest70: pytest==7.0.*
24+
pytest71: pytest==7.1.*
25+
pytest72: pytest==7.2.*
26+
pytest73: pytest==7.3.*
27+
pytest74: pytest==7.4.*
28+
devdeps: git+https://github.com/pytest-dev/pytest#egg=pytest
29+
devdeps: numpy>=0.0.dev0
30+
devdeps: pandas>=0.0.dev0
31+
devdeps: astropy>=0.0.dev0
2232
extras =
2333
test
2434
commands =
35+
# Force numpy-dev after something in the stack downgrades it
36+
devdeps: python -m pip install --pre --upgrade --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
2537
pip freeze
2638
pytest {toxinidir}/tests {posargs}
2739
pytest {toxinidir}/tests --arraydiff {posargs}
2840

2941
[testenv:codestyle]
3042
skip_install = true
43+
changedir = {toxinidir}
3144
description = check code style, e.g. with flake8
3245
deps = flake8
3346
commands = flake8 pytest_arraydiff --count

0 commit comments

Comments
 (0)