From 8b9bfaf7702691cba8ffd548fa943fab1e5e51a3 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 17 Mar 2024 17:47:04 +0200 Subject: [PATCH 1/3] Bump GitHub Actions --- .github/workflows/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4b537c22..84753edb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,15 +16,15 @@ jobs: - {python-version: "pypy-3.9", tox-python-version: "pypy3"} - {python-version: "3.11", tox-python-version: "py311"} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: From 7dacb7ce087ddeb6b1da7a48dcc5a70ce810a1cd Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 17 Mar 2024 18:51:32 +0200 Subject: [PATCH 2/3] Remove redundant code for Python 2 --- ci/bootstrap.py | 2 +- tests/test_pytest_cov.py | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/ci/bootstrap.py b/ci/bootstrap.py index f3c9a7ea..08d6c90b 100755 --- a/ci/bootstrap.py +++ b/ci/bootstrap.py @@ -59,7 +59,7 @@ def main(): # This uses sys.executable the same way that the call in # cookiecutter-pylibrary/hooks/post_gen_project.py # invokes this bootstrap.py itself. - for line in subprocess.check_output([sys.executable, '-m', 'tox', '--listenvs'], universal_newlines=True).splitlines() + for line in subprocess.check_output([sys.executable, '-m', 'tox', '--listenvs'], text=True).splitlines() ] tox_environments = [line for line in tox_environments if line.startswith('py')] for template in templates_path.rglob('*'): diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index 1c9bca86..6778d065 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -20,10 +20,7 @@ import pytest_cov.plugin -try: - from StringIO import StringIO -except ImportError: - from io import StringIO +from io import StringIO coverage, platform # required for skipif mark on test_cov_min_from_coveragerc @@ -1240,8 +1237,7 @@ def test_run(): stdout, stderr = proc.communicate() assert not stderr assert stdout == b"" - # it appears signal handling is buggy on python 2? - if sys.version_info == 3: assert proc.returncode in [128 + signal.SIGTERM, -signal.SIGTERM] + assert proc.returncode in [128 + signal.SIGTERM, -signal.SIGTERM] if __name__ == "__main__": signal.signal(signal.SIGINT, signal.SIG_IGN) @@ -1258,7 +1254,7 @@ def test_run(): result = testdir.runpytest('-vv', '--assert=plain', f'--cov={script.dirpath()}', '--cov-report=term-missing', script) - result.stdout.fnmatch_lines(['*- coverage: platform *, python * -*', 'test_cleanup_on_sigterm* 89% 23-24', '*1 passed*']) + result.stdout.fnmatch_lines(['*- coverage: platform *, python * -*', 'test_cleanup_on_sigterm* 89% 22-23', '*1 passed*']) assert result.ret == 0 @@ -1480,7 +1476,7 @@ def test_dist_boxed(testdir): @pytest.mark.skipif('sys.platform == "win32"') -@pytest.mark.skipif('sys.version_info[0] > 2 and platform.python_implementation() == "PyPy"', reason='strange optimization on PyPy3') +@pytest.mark.skipif('platform.python_implementation() == "PyPy"', reason='strange optimization on PyPy3') def test_dist_bare_cov(testdir): script = testdir.makepyfile(SCRIPT_SIMPLE) From fa7ec7be26dd27aa88296de7270b5515e053297a Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Sun, 17 Mar 2024 19:21:08 +0200 Subject: [PATCH 3/3] Sort imports --- tests/test_pytest_cov.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_pytest_cov.py b/tests/test_pytest_cov.py index 6778d065..2049ef7b 100644 --- a/tests/test_pytest_cov.py +++ b/tests/test_pytest_cov.py @@ -6,6 +6,7 @@ import re import subprocess import sys +from io import StringIO from itertools import chain import coverage @@ -20,8 +21,6 @@ import pytest_cov.plugin -from io import StringIO - coverage, platform # required for skipif mark on test_cov_min_from_coveragerc max_worker_restart_0 = '--max-worker-restart=0'