From 829d7e257c74b29b24889c0e86f01681d130b767 Mon Sep 17 00:00:00 2001 From: "P. L. Lim" <2090236+pllim@users.noreply.github.com> Date: Mon, 8 Jan 2024 18:17:34 -0500 Subject: [PATCH] Modernize testing framework by copying over config from pytest-doctestplus to use Actions instead of Azure Pipelines. Added dependabot for future auto-updates. Updated Action version for publish workflow. Bump minimum versions to be consistent with pytest-doctestplus. Add change logs. --- .github/dependabot.yml | 15 ++++++ .github/workflows/publish.yml | 4 +- .github/workflows/python-tests.yml | 82 ++++++++++++++++++++++++++++++ CHANGES.rst | 4 +- azure-pipelines.yml | 34 ------------- setup.cfg | 10 ++-- tox.ini | 29 ++++++++--- 7 files changed, 129 insertions(+), 49 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/python-tests.yml delete mode 100644 azure-pipelines.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..6b0c235 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: ".github/workflows" # Location of package manifests + schedule: + interval: "weekly" + groups: + actions: + patterns: + - "*" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 35107c7..f263406 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,10 +13,10 @@ jobs: if: ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || contains(github.event.pull_request.labels.*.name, 'Build wheels')) steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v5 with: python-version: 3.8 diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml new file mode 100644 index 0000000..a9a5255 --- /dev/null +++ b/.github/workflows/python-tests.yml @@ -0,0 +1,82 @@ +name: Run unit tests + +on: + pull_request: + push: + branches: [ main ] + tags: + - '*' + workflow_dispatch: + schedule: + # Run every Thursday at 03:53 UTC + - cron: 53 3 * * 4 + +jobs: + tests: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + python-version: 3.8 + toxenv: py38-test-pytestoldest + - os: windows-latest + python-version: 3.8 + toxenv: py38-test-pytest50 + - os: macos-latest + python-version: 3.8 + toxenv: py38-test-pytest51 + - os: ubuntu-latest + python-version: 3.8 + toxenv: py38-test-pytest52 + - os: windows-latest + python-version: 3.8 + toxenv: py38-test-pytest53 + - os: ubuntu-latest + python-version: 3.8 + toxenv: py38-test-pytest60 + - os: ubuntu-latest + python-version: 3.9 + toxenv: py39-test-pytest61 + - os: ubuntu-latest + python-version: 3.9 + toxenv: py39-test-pytest62 + - os: ubuntu-latest + python-version: '3.10' + toxenv: py310-test-pytest70 + - os: ubuntu-latest + python-version: '3.10' + toxenv: py310-test-pytest71 + - os: windows-latest + python-version: '3.11' + toxenv: py311-test-pytest72 + - os: ubuntu-latest + python-version: '3.11' + toxenv: py311-test-pytest73 + - os: ubuntu-latest + python-version: '3.11' + toxenv: py311-test-pytest74 + toxargs: --pre + - os: macos-latest + python-version: '3.11' + toxenv: py311-test-pytestdev + - os: windows-latest + python-version: '3.11' + toxenv: py311-test-pytestdev + - os: ubuntu-latest + python-version: '3.12' + toxenv: py312-test-pytestdev + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install Tox + run: python -m pip install tox + - name: Run Tox + run: tox ${{ matrix.toxargs }} -v -e ${{ matrix.toxenv }} diff --git a/CHANGES.rst b/CHANGES.rst index 42f9588..39edf59 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,9 @@ 0.1.3 (unreleased) ================== -- No changes yet. +- pytest 8.1 compatibility. [#15] + +- Dropped Python 3.7 support. Minimum supported pytest is now 4.6. [#15] 0.1.2 (2022-12-11) ================== diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index c767ed8..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,34 +0,0 @@ -resources: - repositories: - - repository: OpenAstronomy - type: github - endpoint: astropy - name: OpenAstronomy/azure-pipelines-templates - ref: master - -jobs: -- template: run-tox-env.yml@OpenAstronomy - parameters: - envs: - # Code style - - linux: codestyle - # Standard tests - - linux: py37-test - - linux: py38-test - - linux: py39-test - - linux: py310-test - - linux: py311-test - - macos: py37-test - - macos: py38-test - - macos: py39-test - - macos: py310-test - - windows: py38-test - - windows: py39-test - - windows: py310-test - -# Until https://github.com/OpenAstronomy/azure-pipelines-templates/issues/86 is fixed, then move this back to the previous job -- template: run-tox-env.yml@OpenAstronomy - parameters: - toxverspec: <4 - envs: - - windows: py37-test diff --git a/setup.cfg b/setup.cfg index d49ed02..9d2905d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,18 +4,18 @@ url = https://github.com/astropy/pytest-filter-subpackage author = The Astropy Developers author_email = astropy.team@gmail.com classifiers = - Development Status :: 3 - Alpha + Development Status :: 5 - Production/Stable Framework :: Pytest Intended Audience :: Developers License :: OSI Approved :: BSD License Operating System :: OS Independent Programming Language :: Python Programming Language :: Python :: 3 - Programming Language :: Python :: 3.7 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 Topic :: Software Development :: Testing Topic :: Utilities license = BSD @@ -27,9 +27,9 @@ keywords = pytest, py.test [options] zip_safe = False packages = find: -python_requires = >=3.7 +python_requires = >=3.8 install_requires = - pytest>=3.0 + pytest>=4.6 [options.entry_points] pytest11 = @@ -42,7 +42,7 @@ test = pytest-cov [tool:pytest] -minversion = 3.0 +minversion = 4.6 testpaths = tests pytest_filter_subpackage xfail_strict = true filterwarnings = diff --git a/tox.ini b/tox.ini index 80cd61e..efcd0c5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] envlist = - py{37,38,39,310,311}-test + py{38,39,310,311,312}-test codestyle requires = setuptools >= 30.3.0 @@ -8,15 +8,30 @@ requires = isolated_build = true [testenv] -changedir = - test: .tmp/{envname} -description = - test: run tests with pytest +changedir = .tmp/{envname} +description = run tests with pytest +deps = + pytestoldest: pytest==4.6.0 + pytest50: pytest==5.0.* + pytest51: pytest==5.1.* + pytest52: pytest==5.2.* + pytest53: pytest==5.3.* + pytest60: pytest==6.0.* + pytest61: pytest==6.1.* + pytest62: pytest==6.2.* + pytest70: pytest==7.0.* + pytest71: pytest==7.1.* + pytest72: pytest==7.2.* + pytest73: pytest==7.3.* + pytest74: pytest==7.4.* + pytestdev: git+https://github.com/pytest-dev/pytest#egg=pytest + extras = - test: test + test + commands = pip freeze - test: pytest {toxinidir}/tests {posargs} + pytest {toxinidir}/tests {posargs} [testenv:codestyle] skip_install = true