Skip to content

Updated continuous integration #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 29 additions & 42 deletions .github/workflows/ci_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,34 @@ on:
# Run every Sunday at 06:53 UTC
- cron: 53 6 * * 0

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: 3.7
toxenv: py37-test-pytest46
- os: windows-latest
python-version: 3.7
toxenv: py37-test-pytest50
- os: macos-latest
python-version: 3.8
toxenv: py38-test-pytest52
- os: ubuntu-latest
python-version: 3.8
toxenv: py38-test-pytest53
- os: windows-latest
python-version: 3.9
toxenv: py39-test-pytest60
- os: macos-latest
python-version: 3.9
toxenv: py39-test-pytest61
- os: ubuntu-latest
python-version: '3.10'
toxenv: py310-test-pytest62
- os: ubuntu-latest
python-version: '3.10'
toxenv: py310-test-pytestdev

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install tox
run: python -m pip install tox
- name: Run tox
run: tox -v -e ${{ matrix.toxenv }}
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v1
with:
envs: |
- linux: codestyle
- linux: py37-test-pytestoldest
- macos: py37-test-pytest50
- windows: py38-test-pytest52
- linux: py38-test-pytest53
- macos: py39-test-pytest60
- windows: py39-test-pytest61
- linux: py310-test-pytest62
- macos: py310-test-pytest70
- windows: py310-test-pytest71
- linux: py311-test-pytest72
- macos: py311-test-pytest73
- windows: py312-test-pytest74
- linux: py312-test-devdeps
publish:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean? Can we still use the "Build wheels" label on PRs here?

Copy link
Member Author

@astrofrog astrofrog Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wheels are always built in PRs with this config. It's so fast there's no point making it optional.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wheels will always be built but only published to PyPI on a tag

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK so after we have merged this, we should delete that "Build wheels" label.

needs: tests
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v1
with:
test_extras: test
test_command: pytest $GITHUB_WORKSPACE/tests; pytest --arraydiff $GITHUB_WORKSPACE/tests
secrets:
pypi_token: ${{ secrets.pypi_password }}
48 changes: 0 additions & 48 deletions .github/workflows/publish.yml

This file was deleted.

9 changes: 3 additions & 6 deletions pytest_arraydiff/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
#
# https://github.com/astrofrog/pytest-mpl


from functools import wraps

import os
import abc
import shutil
Expand Down Expand Up @@ -149,9 +146,9 @@ def read(filename):

@staticmethod
def write(filename, data, **kwargs):
import pandas as pd
import pandas as pd # noqa: F401
key = os.path.basename(filename).replace('.h5', '')
return data.to_hdf(filename, key, **kwargs)
return data.to_hdf(filename, key=key, **kwargs)

@classmethod
def compare(cls, reference_file, test_file, atol=None, rtol=None):
Expand Down Expand Up @@ -201,7 +198,7 @@ def pytest_addoption(parser):
def pytest_configure(config):
config.getini('markers').append(
'array_compare: for functions using array comparison')

if config.getoption("--arraydiff") or config.getoption("--arraydiff-generate-path") is not None:

reference_dir = config.getoption("--arraydiff-reference-path")
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ classifiers =
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: Implementation :: CPython
Topic :: Software Development :: Testing
Topic :: Utilities
Expand Down
4 changes: 4 additions & 0 deletions tests/test_pytest_arraydiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

import pytest
import numpy as np
from packaging.version import Version

NUMPY_LT_2_0 = Version(np.__version__) < Version("2.0.dev")

reference_dir = 'baseline'

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


@pytest.mark.skipif(not NUMPY_LT_2_0, reason="AttributeError: `np.unicode_` was removed in the NumPy 2.0 release. Use `np.str_` instead.")
@pytest.mark.array_compare(file_format='pd_hdf', reference_dir=reference_dir)
def test_succeeds_func_pdhdf():
pd = pytest.importorskip('pandas')
Expand Down
19 changes: 16 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{37,38,39,310}-test{,-devdeps}
py{37,38,39,310,311,312}-test{,-pytestoldest,-pytest50,-pytest52,-pytest53,-pytest60,-pytest61,-pytest62,-pytest70,-pytest71,-pytest72,-pytest73,-pytest74,-devdeps}
codestyle
requires =
setuptools >= 30.3.0
Expand All @@ -9,25 +9,38 @@ isolated_build = true

[testenv]
changedir = .tmp/{envname}
setenv =
devdeps: PIP_EXTRA_INDEX_URL = https://pypi.anaconda.org/astropy/simple https://pypi.anaconda.org/scientific-python-nightly-wheels/simple
description = run tests
deps =
pytest46: pytest==4.6.*
pytestoldest: pytest==4.6.0
pytest50: pytest==5.0.*
pytest52: pytest==5.2.*
pytest53: pytest==5.3.*
pytest60: pytest==6.0.*
pytest61: pytest==6.1.*
pytest62: pytest==6.2.*
pytestdev: git+https://github.com/pytest-dev/pytest#egg=pytest
pytest70: pytest==7.0.*
pytest71: pytest==7.1.*
pytest72: pytest==7.2.*
pytest73: pytest==7.3.*
pytest74: pytest==7.4.*
devdeps: git+https://github.com/pytest-dev/pytest#egg=pytest
devdeps: numpy>=0.0.dev0
devdeps: pandas>=0.0.dev0
devdeps: astropy>=0.0.dev0
extras =
test
commands =
# Force numpy-dev after something in the stack downgrades it
devdeps: python -m pip install --pre --upgrade --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
pip freeze
pytest {toxinidir}/tests {posargs}
pytest {toxinidir}/tests --arraydiff {posargs}

[testenv:codestyle]
skip_install = true
changedir = {toxinidir}
description = check code style, e.g. with flake8
deps = flake8
commands = flake8 pytest_arraydiff --count