From 26203f2c2cfdca9cf451103fdb42057cd20ca1a2 Mon Sep 17 00:00:00 2001 From: Michal Charemza Date: Fri, 20 Sep 2024 16:58:59 +0100 Subject: [PATCH] tests: fix for release candidates (and test on more versions of Python) Fixes https://github.com/uktrade/stream-zip/issues/146 Fixes https://github.com/uktrade/stream-zip/issues/146 Includes loosening the constraints on versions used to run tests in CI (e.g. pytest, coverage) since the older versions don't seem to work on newer Python. Specifically, coverage 6.2 bombs out with an error on Python 3.11) --- .github/workflows/test.yml | 10 ++++++++-- pyproject.toml | 3 --- test_stream_zip.py | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4de9397..9a1a7ac 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,11 +24,17 @@ jobs: os: "ubuntu-20.04" - python-version: "3.10.0" os: "ubuntu-20.04" + - python-version: "3.11.0" + os: "ubuntu-20.04" + - python-version: "3.12.0" + os: "ubuntu-20.04" + - python-version: "3.13.0-rc.2" + os: "ubuntu-20.04" runs-on: ${{ matrix.os }} steps: - name: "Checkout" uses: "actions/checkout@v3" - - uses: "actions/setup-python@v4" + - uses: "actions/setup-python@v5" with: python-version: '${{ matrix.python-version }}' - name: "Install bsdcpio" @@ -47,7 +53,7 @@ jobs: ) - name: "Install python dependencies" run: | - pip install ".[ci]" + pip install ".[dev,ci]" - name: "Run type checking" run: | mypy stream_zip --strict diff --git a/pyproject.toml b/pyproject.toml index 9769676..ec0a7a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,9 +33,6 @@ dev = [ ] ci = [ "pycryptodome==3.10.1", - "coverage==6.2", - "pytest==7.0.1", - "pytest-cov==3.0.0", "stream-unzip==0.0.86", "pyzipper==0.3.6", # Type checking diff --git a/test_stream_zip.py b/test_stream_zip.py index 8c06617..eb378fd 100644 --- a/test_stream_zip.py +++ b/test_stream_zip.py @@ -1388,7 +1388,7 @@ async def test(): @pytest.mark.skipif( - tuple(int(v) for v in platform.python_version().split('.')) < (3,7,0), + tuple(int(v) for v in platform.python_version().split('.')[:2]) < (3,7,0), reason="contextvars are not supported before Python 3.7.0", ) def test_copy_of_context_variable_available_in_iterable():