diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 0ea9d7a7..c072cfe7 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -23,12 +23,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4.1.1 + uses: actions/checkout@v4 - - name: Install python 3.9 - uses: actions/setup-python@v5.1.0 + - name: Install python 3.11 + uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: 3.11 architecture: x64 - name: Install noxfile requirements @@ -57,11 +57,11 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v4.1.1 + uses: actions/checkout@v4 # General case - - name: Install python ${{ matrix.nox_session.python }} for tests (not 3.5 not 3.13) - if: ${{ ! contains(fromJson('["3.5", "3.13"]'), matrix.nox_session.python ) }} + - name: Install python ${{ matrix.nox_session.python }} for tests (not 3.5 not 3.14) + if: ${{ ! contains(fromJson('["3.5", "3.14"]'), matrix.nox_session.python ) }} uses: MatteoH2O1999/setup-python@v4 # actions/setup-python@v5.0.0 id: set-py with: @@ -86,8 +86,8 @@ jobs: PIP_TRUSTED_HOST: "pypi.python.org pypi.org files.pythonhosted.org" - - name: Install python ${{ matrix.nox_session.python }} for tests (3.13) - if: contains(fromJson('["3.13"]'), matrix.nox_session.python ) + - name: Install python ${{ matrix.nox_session.python }} for tests (3.14) + if: contains(fromJson('["3.14"]'), matrix.nox_session.python ) uses: actions/setup-python@v5 id: set-py-latest with: @@ -99,7 +99,7 @@ jobs: cache-build: true - name: Install python 3.12 for nox - uses: actions/setup-python@v5.1.0 + uses: actions/setup-python@v5 with: python-version: 3.12 architecture: x64 @@ -118,7 +118,7 @@ jobs: # Share ./docs/reports so that they can be deployed with doc in next job - name: Share reports with other jobs if: runner.os == 'Linux' - uses: actions/upload-artifact@v4.3.1 + uses: actions/upload-artifact@v4 with: name: reports_dir path: ./docs/reports @@ -128,12 +128,12 @@ jobs: if: github.event_name == 'pull_request' steps: - name: Checkout - uses: actions/checkout@v4.1.1 + uses: actions/checkout@v4 - - name: Install python 3.9 for nox - uses: actions/setup-python@v5.1.0 + - name: Install python 3.11 for nox + uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: 3.11 architecture: x64 - name: Install noxfile requirements @@ -153,19 +153,20 @@ jobs: run: echo "$GITHUB_CONTEXT" - name: Checkout with no depth - uses: actions/checkout@v4.1.1 + uses: actions/checkout@v4 with: fetch-depth: 0 # so that gh-deploy works + # persist-credentials: false # see https://github.com/orgs/community/discussions/25702 - - name: Install python 3.9 for nox - uses: actions/setup-python@v5.1.0 + - name: Install python 3.11 for nox + uses: actions/setup-python@v5 with: - python-version: 3.9 + python-version: 3.11 architecture: x64 # 1) retrieve the reports generated previously - name: Retrieve reports - uses: actions/download-artifact@v4.1.4 + uses: actions/download-artifact@v4 with: name: reports_dir path: ./docs/reports @@ -197,7 +198,7 @@ jobs: EOF - name: \[not on TAG\] Publish coverage report if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads') - uses: codecov/codecov-action@v4.1.1 + uses: codecov/codecov-action@v4 with: files: ./docs/reports/coverage/coverage.xml - name: \[not on TAG\] Build wheel and sdist @@ -209,7 +210,11 @@ jobs: # 7) Create github release and build the wheel - name: \[TAG only\] Build wheel and create github release if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - run: nox -s release -- ${{ secrets.GITHUB_TOKEN }} + # We would have to use a PAT instead of GITHUB_TOKEN if we want the next job to trigger. + # See https://github.com/orgs/community/discussions/25702 + # For now we will rather rely on a "workflow completed" trigger to avoid + # having a token expiration date to manage + run: nox -s release -- ${{ secrets.GITHUB_TOKEN }} # ${{ secrets.WORKFLOW_SECRET}} # 8) Publish the wheel on PyPi - name: \[TAG only\] Deploy on PyPi diff --git a/.github/workflows/ghpages.yml b/.github/workflows/ghpages.yml new file mode 100644 index 00000000..909c2a25 --- /dev/null +++ b/.github/workflows/ghpages.yml @@ -0,0 +1,53 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Deploy Static Website from gh-pages branch + +on: + # Runs on pushes targeting the default branch + push: + branches: ["gh-pages"] + + # Since the pushes made by the workflow using GITHUB_TOKEN do not trigger the above, + # Add an explicit trigger for workflow completion + workflow_run: + workflows: ['Build'] + types: [completed] + branches: + - 'main' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: gh-pages + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + # Upload entire repository + path: '.' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml index 7ccec7f8..e3a55ee6 100644 --- a/.github/workflows/updater.yml +++ b/.github/workflows/updater.yml @@ -12,13 +12,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.1.1 + - uses: actions/checkout@v4 with: # [Required] Access token with `workflow` scope. token: ${{ secrets.WORKFLOW_SECRET }} - name: Run GitHub Actions Version Updater - uses: saadmk11/github-actions-version-updater@v0.8.1 + uses: saadmk11/github-actions-version-updater@v0.8 with: # [Required] Access token with `workflow` scope. token: ${{ secrets.WORKFLOW_SECRET }} diff --git a/README.md b/README.md index 8f7444d2..837d16f0 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Separate test code from test cases in `pytest`. -[![Python versions](https://img.shields.io/pypi/pyversions/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) ![Pytest versions](https://img.shields.io/badge/pytest-3%20%7C%204%20%7C%205%20%7C%206%20%7C%207%20%7C%208-blue) [![Build Status](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml/badge.svg)](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml) [![Tests Status](https://smarie.github.io/python-pytest-cases/reports/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/junit/report.html) [![Coverage Status](https://smarie.github.io/python-pytest-cases/reports/coverage/coverage-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/coverage/index.html) [![codecov](https://codecov.io/gh/smarie/python-pytest-cases/branch/main/graph/badge.svg)](https://codecov.io/gh/smarie/python-pytest-cases) [![Flake8 Status](https://smarie.github.io/python-pytest-cases/reports/flake8/flake8-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/flake8/index.html) +[![Python versions](https://img.shields.io/pypi/pyversions/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) ![Pytest versions](https://img.shields.io/badge/pytest-6%20%7C%207%20%7C%208-blue) [![Build Status](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml/badge.svg)](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml) [![Tests Status](https://smarie.github.io/python-pytest-cases/reports/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/junit/report.html) [![Coverage Status](https://smarie.github.io/python-pytest-cases/reports/coverage/coverage-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/coverage/index.html) [![codecov](https://codecov.io/gh/smarie/python-pytest-cases/branch/main/graph/badge.svg)](https://codecov.io/gh/smarie/python-pytest-cases) [![Flake8 Status](https://smarie.github.io/python-pytest-cases/reports/flake8/flake8-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/flake8/index.html) [![Documentation](https://img.shields.io/badge/doc-latest-blue.svg)](https://smarie.github.io/python-pytest-cases/) [![PyPI](https://img.shields.io/pypi/v/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) [![Downloads](https://pepy.tech/badge/pytest-cases)](https://pepy.tech/project/pytest-cases) [![Downloads per week](https://pepy.tech/badge/pytest-cases/week)](https://pepy.tech/project/pytest-cases) [![GitHub stars](https://img.shields.io/github/stars/smarie/python-pytest-cases.svg)](https://github.com/smarie/python-pytest-cases/stargazers) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3937829.svg)](https://doi.org/10.5281/zenodo.3937829) diff --git a/ci_tools/nox_utils.py b/ci_tools/nox_utils.py index 3c4df0f5..74a9b157 100644 --- a/ci_tools/nox_utils.py +++ b/ci_tools/nox_utils.py @@ -12,8 +12,9 @@ nox_logger = logging.getLogger("nox") -PY27, PY35, PY36, PY37, PY38, PY39, PY310, PY311, PY312, PY313 = ("2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", - "3.11", "3.12", "3.13") +PY27, PY35, PY36, PY37, PY38, PY39, PY310, PY311, PY312, PY313, PY314 = ( + "2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14" +) DONT_INSTALL = "dont_install" diff --git a/docs/changelog.md b/docs/changelog.md index 269fd663..519a2e48 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,11 @@ # Changelog +### 3.8.7 - compatibility with pytest 8.6.0 + +- Dropped support for `python<3.9` and `pytest<6`. Fixes + [#362](https://github.com/smarie/python-pytest-cases/issues/362) and fixes + [#186](https://github.com/smarie/python-pytest-cases/issues/186) + ### 3.8.6 - compatibility fix - Fixed issue with legacy python 2.7 and 3.5. Fixes [#352](https://github.com/smarie/python-pytest-cases/issues/352). diff --git a/docs/index.md b/docs/index.md index deb352a5..420ad927 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,7 +2,7 @@ *Separate test code from test cases in `pytest`.* -[![Python versions](https://img.shields.io/pypi/pyversions/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) ![Pytest versions](https://img.shields.io/badge/pytest-3%20%7C%204%20%7C%205%20%7C%206%20%7C%207%20%7C%208-blue) [![Build Status](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml/badge.svg)](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml) [![Tests Status](./reports/junit/junit-badge.svg?dummy=8484744)](./reports/junit/report.html) [![Coverage Status](./reports/coverage/coverage-badge.svg?dummy=8484744)](./reports/coverage/index.html) [![codecov](https://codecov.io/gh/smarie/python-pytest-cases/branch/main/graph/badge.svg)](https://codecov.io/gh/smarie/python-pytest-cases) [![Flake8 Status](./reports/flake8/flake8-badge.svg?dummy=8484744)](./reports/flake8/index.html) +[![Python versions](https://img.shields.io/pypi/pyversions/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) ![Pytest versions](https://img.shields.io/badge/pytest-6%20%7C%207%20%7C%208-blue) [![Build Status](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml/badge.svg)](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml) [![Tests Status](./reports/junit/junit-badge.svg?dummy=8484744)](./reports/junit/report.html) [![Coverage Status](./reports/coverage/coverage-badge.svg?dummy=8484744)](./reports/coverage/index.html) [![codecov](https://codecov.io/gh/smarie/python-pytest-cases/branch/main/graph/badge.svg)](https://codecov.io/gh/smarie/python-pytest-cases) [![Flake8 Status](./reports/flake8/flake8-badge.svg?dummy=8484744)](./reports/flake8/index.html) [![Documentation](https://img.shields.io/badge/doc-latest-blue.svg)](https://smarie.github.io/python-pytest-cases/) [![PyPI](https://img.shields.io/pypi/v/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) [![Downloads](https://pepy.tech/badge/pytest-cases)](https://pepy.tech/project/pytest-cases) [![Downloads per week](https://pepy.tech/badge/pytest-cases/week)](https://pepy.tech/project/pytest-cases) [![GitHub stars](https://img.shields.io/github/stars/smarie/python-pytest-cases.svg)](https://github.com/smarie/python-pytest-cases/stargazers) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3937829.svg)](https://doi.org/10.5281/zenodo.3937829) diff --git a/docs/long_description.md b/docs/long_description.md index df4b6fd3..7939f9e6 100644 --- a/docs/long_description.md +++ b/docs/long_description.md @@ -1,6 +1,6 @@ # pytest-cases -[![Python versions](https://img.shields.io/pypi/pyversions/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) ![Pytest versions](https://img.shields.io/badge/pytest-2%20%7C%203%20%7C%204%20%7C%205%20%7C%206%20%7C%207-blue) [![Build Status](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml/badge.svg)](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml) [![Tests Status](https://smarie.github.io/python-pytest-cases/reports/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/junit/report.html) [![Coverage Status](https://smarie.github.io/python-pytest-cases/reports/coverage/coverage-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/coverage/index.html) [![codecov](https://codecov.io/gh/smarie/python-pytest-cases/branch/main/graph/badge.svg)](https://codecov.io/gh/smarie/python-pytest-cases) [![Flake8 Status](https://smarie.github.io/python-pytest-cases/reports/flake8/flake8-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/flake8/index.html) +[![Python versions](https://img.shields.io/pypi/pyversions/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) ![Pytest versions](https://img.shields.io/badge/pytest-6%20%7C%207%20%7C%208-blue) [![Build Status](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml/badge.svg)](https://github.com/smarie/python-pytest-cases/actions/workflows/base.yml) [![Tests Status](https://smarie.github.io/python-pytest-cases/reports/junit/junit-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/junit/report.html) [![Coverage Status](https://smarie.github.io/python-pytest-cases/reports/coverage/coverage-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/coverage/index.html) [![codecov](https://codecov.io/gh/smarie/python-pytest-cases/branch/main/graph/badge.svg)](https://codecov.io/gh/smarie/python-pytest-cases) [![Flake8 Status](https://smarie.github.io/python-pytest-cases/reports/flake8/flake8-badge.svg?dummy=8484744)](https://smarie.github.io/python-pytest-cases/reports/flake8/index.html) [![Documentation](https://img.shields.io/badge/doc-latest-blue.svg)](https://smarie.github.io/python-pytest-cases/) [![PyPI](https://img.shields.io/pypi/v/pytest-cases.svg)](https://pypi.python.org/pypi/pytest-cases/) [![Downloads](https://pepy.tech/badge/pytest-cases)](https://pepy.tech/project/pytest-cases) [![Downloads per week](https://pepy.tech/badge/pytest-cases/week)](https://pepy.tech/project/pytest-cases) [![GitHub stars](https://img.shields.io/github/stars/smarie/python-pytest-cases.svg)](https://github.com/smarie/python-pytest-cases/stargazers) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3937829.svg)](https://doi.org/10.5281/zenodo.3937829) diff --git a/noxfile.py b/noxfile.py index b1835b74..c4b63b44 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,5 +1,3 @@ -import argparse -import json import logging import nox # noqa @@ -9,8 +7,7 @@ # add parent folder to python path so that we can import noxfile_utils.py # note that you need to "pip install -r noxfile-requiterements.txt" for this file to work. sys.path.append(str(Path(__file__).parent / "ci_tools")) -from nox_utils import (PY27, PY37, PY36, PY35, PY38, PY39, PY310, PY311, PY312, PY313, install_reqs, rm_folder, rm_file, - DONT_INSTALL) # noqa +from nox_utils import (PY39, PY310, PY311, PY312, PY313, PY314, install_reqs, rm_folder, rm_file, DONT_INSTALL) # noqa pkg_name = "pytest_cases" @@ -54,46 +51,23 @@ class Folders: ENVS = { + # python 3.14 - numpy is not available in precompiled version for this python version yet + # (PY314, "pytest-latest"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": ""}}, # python 3.13 (PY313, "pytest-latest"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": ""}}, # python 3.12 (PY312, "pytest-latest"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": ""}}, (PY312, "pytest7.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<8"}}, # python 3.11 - (PY311, "pytest-latest"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": ""}}, + # We'll run this last for coverage # python 3.10 (PY310, "pytest-latest"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": ""}}, # python 3.9 (PY39, "pytest-latest"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": ""}}, (PY39, "pytest7.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<8"}}, (PY39, "pytest6.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<7"}}, - # python 3.8 - (PY38, "pytest4.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<5"}}, - (PY38, "pytest5.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<6", "pytest-asyncio": DONT_INSTALL}}, - (PY38, "pytest6.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<7"}}, - (PY38, "pytest7.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<8"}}, - (PY38, "pytest-latest"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": ""}}, - # python 2.7 - (PY27, "pytest3.x"): {"coverage": False, "pkg_specs": {"pip": ">10", "pytest": "<4", "pytest-harvest": "<1.10.5", "pytest-asyncio": DONT_INSTALL}}, - (PY27, "pytest4.x"): {"coverage": False, "pkg_specs": {"pip": ">10", "pytest": "<5", "pytest-harvest": "<1.10.5", "pytest-asyncio": DONT_INSTALL}}, - # python 3.5 - (PY35, "pytest3.x"): {"coverage": False, "pkg_specs": {"pip": ">10", "pytest": "<4", "pytest-harvest": "<1.10.5", "pytest-asyncio": DONT_INSTALL}}, - (PY35, "pytest4.x"): {"coverage": False, "pkg_specs": {"pip": ">10", "pytest": "<5", "pytest-harvest": "<1.10.5", "pytest-asyncio": DONT_INSTALL}}, - (PY35, "pytest5.x"): {"coverage": False, "pkg_specs": {"pip": ">10", "pytest": "<6", "pytest-harvest": "<1.10.5"}}, - # python 3.6 - (PY36, "pytest3.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<4"}}, - (PY36, "pytest4.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<5"}}, - (PY36, "pytest5.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<6"}}, - (PY36, "pytest6.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<7"}}, - (PY36, "pytest-latest"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": ""}}, - # python 3.7 - (PY37, "pytest3.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<4"}}, - (PY37, "pytest4.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<5"}}, - (PY37, "pytest5.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<6", "pytest-asyncio": DONT_INSTALL}}, - (PY37, "pytest6.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<7"}}, - (PY37, "pytest7.x"): {"coverage": False, "pkg_specs": {"pip": ">19", "pytest": "<8"}}, # IMPORTANT: this should be last so that the folder docs/reports is not deleted afterwards - (PY37, "pytest-latest"): {"coverage": True, "pkg_specs": {"pip": ">19", "pytest": ""}} + (PY311, "pytest-latest"): {"coverage": True, "pkg_specs": {"pip": ">19", "pytest": ""}}, } ENV_PARAMS = tuple((k[0], v["coverage"], v["pkg_specs"]) for k, v in ENVS.items()) @@ -166,7 +140,7 @@ def tests(session, coverage, pkg_specs): "-m", "pytest", "--cache-clear", f"--junitxml={Folders.test_xml}", f"--html={Folders.test_html}", "-v", "tests/") - # session.run("coverage", "report") # this shows in terminal + fails under XX%, same as --cov-report term --cov-fail-under=70 # noqa + session.run("coverage", "report") # this shows in terminal + fails under XX%, same as --cov-report term --cov-fail-under=70 # noqa session.run("coverage", "xml", "-o", f"{Folders.coverage_xml}") session.run("coverage", "html", "-d", f"{Folders.coverage_reports}") # delete this intermediate file, it is not needed anymore @@ -179,7 +153,7 @@ def tests(session, coverage, pkg_specs): session.run("genbadge", "coverage", "-i", f"{Folders.coverage_xml}", "-o", f"{Folders.coverage_badge}") -@nox.session(python=PY39) +@nox.session(python=PY311) def flake8(session): """Launch flake8 qualimetry.""" @@ -200,7 +174,7 @@ def flake8(session): rm_file(Folders.flake8_intermediate_file) -@nox.session(python=PY39) +@nox.session(python=PY311) def docs(session): """Generates the doc. Pass '-- serve' to serve it on a local http server instead.""" @@ -213,7 +187,7 @@ def docs(session): session.run("mkdocs", "build") -@nox.session(python=PY39) +@nox.session(python=PY311) def publish(session): """Deploy the docs+reports on github pages. Note: this rebuilds the docs""" @@ -258,18 +232,19 @@ def my_scheme(version_): session.run("python", "setup.py", "sdist", "bdist_wheel") - # Make sure that the generated _version.py file exists and is compliant with python 2.7 + # Make sure that the generated _version.py file exists version_py = Path(f"src/{pkg_name}/_version.py") if not version_py.exists(): raise ValueError("Error with setuptools_scm: _version.py file not generated") - if ":" in version_py.read_text(): - raise ValueError("Error with setuptools_scm: _version.py file contains annotations") + # ...and is compliant with python 2.7 + # if ":" in version_py.read_text(): + # raise ValueError("Error with setuptools_scm: _version.py file contains annotations") return current_tag, version -@nox.session(python=PY39) +@nox.session(python=PY311) def build(session): """Same as release but just builds""" @@ -278,7 +253,7 @@ def build(session): print(f"version: {version}") -@nox.session(python=PY39) +@nox.session(python=PY311) def release(session): """Create a release on github corresponding to the latest tag""" @@ -319,34 +294,34 @@ def release(session): "-d", f"https://{gh_org}.github.io/{gh_repo}/changelog", current_tag) -@nox.session(python=False) -def gha_list(session): - """(mandatory arg: ) Prints all sessions available for , for GithubActions.""" - - # see https://stackoverflow.com/q/66747359/7262247 - - # The options - parser = argparse.ArgumentParser() - parser.add_argument("-s", "--session", help="The nox base session name") - parser.add_argument( - "-v", - "--with_version", - action="store_true", - default=False, - help="Return a list of lists where the first element is the python version and the second the nox session.", - ) - additional_args = parser.parse_args(session.posargs) - - # Now use --json CLI option - out = session.run("nox", "-l", "--json", "-s", "tests", external=True, silent=True) - sessions_list = [{"python": s["python"], "session": s["session"]} for s in json.loads(out)] - - # TODO filter ? - - # print the list so that it can be caught by GHA. - # Note that json.dumps is optional since this is a list of string. - # However it is to remind us that GHA expects a well-formatted json list of strings. - print(json.dumps(sessions_list)) +# @nox.session(python=False) +# def gha_list(session): +# """(mandatory arg: ) Prints all sessions available for , for GithubActions.""" +# +# # see https://stackoverflow.com/q/66747359/7262247 +# +# # The options +# parser = argparse.ArgumentParser() +# parser.add_argument("-s", "--session", help="The nox base session name") +# parser.add_argument( +# "-v", +# "--with_version", +# action="store_true", +# default=False, +# help="Return a list of lists where the first element is the python version and the second the nox session.", +# ) +# additional_args = parser.parse_args(session.posargs) +# +# # Now use --json CLI option +# out = session.run("nox", "-l", "--json", "-s", "tests", external=True, silent=True) +# sessions_list = [{"python": s["python"], "session": s["session"]} for s in json.loads(out)] +# +# # TODO filter ? +# +# # print the list so that it can be caught by GHA. +# # Note that json.dumps is optional since this is a list of string. +# # However it is to remind us that GHA expects a well-formatted json list of strings. +# print(json.dumps(sessions_list)) # if __name__ == '__main__': diff --git a/setup.cfg b/setup.cfg index c50cf14a..78757eb3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,32 +31,22 @@ classifiers = Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.12 + Programming Language :: Python :: 3.14 Framework :: Pytest [options] # one day these will be able to come from requirement files, see https://github.com/pypa/setuptools/issues/1951. But will it be better ? setup_requires = setuptools_scm - packaging install_requires = decopatch makefun>=1.15.1 packaging - # note: pytest, too :) - functools32;python_version<'3.2' - # note: do not use double quotes in these, this triggers a weird bug in PyCharm in debug mode only - funcsigs;python_version<'3.3' + pytest<8.4.0 tests_require = - six - pytest pytest-steps pytest-harvest pytest-asyncio - # for some reason these pytest dependencies were not declared in old versions of pytest - # six;python_version<'3.6' - atomicwrites;python_version<'3.5' - attr;python_version<'3.6' - pluggy;python_version<'3.6' # test_suite = tests --> no need apparently # diff --git a/setup.py b/setup.py index fa5cd8ea..a53e59c3 100644 --- a/setup.py +++ b/setup.py @@ -33,23 +33,7 @@ args = { "write_to": "src/pytest_cases/_version.py", } -# Use the 'version_file_template' directive if possible to avoid type hints and annotations (python <3.8) -setuptools_scm_version = pkg_resources.get_distribution("setuptools_scm").version -# for some reason importing packaging.version.Version here fails on python 3.5 -# from packaging.version import Version -# if Version(setuptools_scm_version) >= Version('6'): -setuptools_scm_version_major = int(setuptools_scm_version.split(".")[0]) -if setuptools_scm_version_major >= 6: - # template_arg_name = "version_file_template" if Version(setuptools_scm_version) >= Version('8.1') else "write_to_template" - # print(Version(setuptools_scm_version)) - # print(template_arg_name) - - # Note that it was named 'write_to_template' earlier. But at that time it was not generating annotations so no need. - args["write_to_template"] = """# file generated by setuptools_scm and customized -# don't change, don't track in version control -__version__ = version = '{version}' -__version_tuple__ = version_tuple = {version_tuple} -""" + # (3) Call setup() with as little args as possible setup( download_url=DOWNLOAD_URL, diff --git a/tests/conftest.py b/tests/conftest.py index db0ac432..11ab9df7 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,10 +2,8 @@ # + All contributors to # # License: 3-clause BSD, -import fnmatch -import sys import pytest -import six + pytest_plugins = ["pytester"] # In order to run meta-tests, see https://docs.pytest.org/en/latest/writing_plugins.html @@ -18,30 +16,30 @@ def environment(): pass -def pytest_ignore_collect(path, config): - """ - In python 2, equivalent of adding - - --ignore-glob='**/*py35*.py' - - This method works even with old pytest 2 and 3. - It was copied from recent pytest.main.pytest_ignore_collect - - :param path: - :param config: - :return: - """ - ignore_globs = [] - - if sys.version_info < (3, 6): - ignore_globs += ['**/*py36*.py'] - if sys.version_info < (3, 5): - ignore_globs += ['**/*py35*.py'] - if any( - fnmatch.fnmatch(six.text_type(path), six.text_type(glob)) - for glob in ignore_globs - ): - return True +# def pytest_ignore_collect(path, config): +# """ +# In python 2, equivalent of adding +# +# --ignore-glob='**/*py35*.py' +# +# This method works even with old pytest 2 and 3. +# It was copied from recent pytest.main.pytest_ignore_collect +# +# :param path: +# :param config: +# :return: +# """ +# ignore_globs = [] +# +# if sys.version_info < (3, 6): +# ignore_globs += ['**/*py36*.py'] +# if sys.version_info < (3, 5): +# ignore_globs += ['**/*py35*.py'] +# if any( +# fnmatch.fnmatch(six.text_type(path), six.text_type(glob)) +# for glob in ignore_globs +# ): +# return True # @pytest.hookimpl(trylast=True)