From fa846350969b12478ee2e008608da70294fa36f6 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Wed, 9 Feb 2022 10:28:06 +0100 Subject: [PATCH] New Python versions in tests --- .github/workflows/main.yaml | 20 ++++++++++--------- README.rst | 4 ++-- setup.py | 1 + tests/fixtures/tox.ini | 2 +- tests/test_integration.py | 38 +++++++++++++++++++++++-------------- tox.ini | 2 +- 6 files changed, 40 insertions(+), 27 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index d8d3838..449efde 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -21,20 +21,22 @@ jobs: tox_env: # This information is repeated in tox.ini # (see https://github.com/fedora-python/tox-github-action/issues/8) - - py36-tox315 - - py37-tox315 - - py38-tox315 - - py39-tox315 - + # Generate it by: tox -l | sed "s/^/- /" - py36-toxrelease - - py37-toxrelease - - py38-toxrelease - - py39-toxrelease - - py36-toxmaster + - py36-toxtox315 + - py37-toxrelease - py37-toxmaster + - py37-toxtox315 + - py38-toxrelease - py38-toxmaster + - py38-toxtox315 + - py39-toxrelease - py39-toxmaster + - py39-toxtox315 + - py310-toxrelease + - py310-toxmaster + - py310-toxtox315 # Use GitHub's Linux Docker host runs-on: ubuntu-latest diff --git a/README.rst b/README.rst index a9127e0..a9c1180 100644 --- a/README.rst +++ b/README.rst @@ -280,8 +280,8 @@ or send Pull Requests. Tests ~~~~~ -In order to run the tests, you'll need ``tox`` and Python 3.6, 3.7, 3.8 and 3.9 installed. -The integration tests assume all four are available. +In order to run the tests, you'll need ``tox`` and Python from 3.6 to 3.10 installed. +The integration tests assume all of them are available. On Fedora, you just need to ``dnf install tox``. Run ``tox`` to invoke the tests. diff --git a/setup.py b/setup.py index ed95a06..d52a0bf 100644 --- a/setup.py +++ b/setup.py @@ -34,6 +34,7 @@ setup( "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development :: Testing", ], diff --git a/tests/fixtures/tox.ini b/tests/fixtures/tox.ini index 87b16cd..0055b26 100644 --- a/tests/fixtures/tox.ini +++ b/tests/fixtures/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py36,py37,py38,py39 +envlist = py36,py37,py38,py39,py310 [testenv] deps = diff --git a/tests/test_integration.py b/tests/test_integration.py index 4b474c4..816b38d 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -16,6 +16,7 @@ import pytest NATIVE_TOXENV = f"py{sys.version_info[0]}{sys.version_info[1]}" +NATIVE_SITE_PACKAGES = f"lib/python{sys.version_info[0]}.{sys.version_info[1]}/site-packages" NATIVE_EXECUTABLE = str(pathlib.Path(sys.executable).resolve()) FIXTURES_DIR = pathlib.Path(__file__).parent / "fixtures" DOT_TOX = pathlib.Path("./.tox") @@ -100,9 +101,9 @@ def is_available(python): return True -needs_py36789 = pytest.mark.skipif( - not all((is_available(f"python3.{x}") for x in range(6, 10))), - reason="This test needs python3.6, 3.7, 3.8 and 3.9 available in $PATH", +needs_py3678910 = pytest.mark.skipif( + not all((is_available(f"python3.{x}") for x in range(6, 12))), + reason="This test needs python3.6, 3.7, 3.8, 3.9 and 3.10 available in $PATH", ) @@ -113,7 +114,7 @@ def test_native_toxenv_current_env(): assert not (DOT_TOX / NATIVE_TOXENV / "lib").is_dir() -@needs_py36789 +@needs_py3678910 def test_all_toxenv_current_env(): result = tox("--current-env", check=False) assert NATIVE_EXEC_PREFIX_MSG in result.stdout.splitlines() @@ -132,7 +133,7 @@ def test_missing_toxenv_current_env(python): assert result.returncode > 0 -@needs_py36789 +@needs_py3678910 def test_all_toxenv_current_env_skip_missing(): result = tox("--current-env", "--skip-missing-interpreters", check=False) assert "InterpreterMismatch:" in result.stdout @@ -255,11 +256,14 @@ def test_allenvs_print_deps(print_deps_stdout_arg): py six py + six + py ___________________________________ summary ____________________________________ py36: commands succeeded py37: commands succeeded py38: commands succeeded py39: commands succeeded + py310: commands succeeded congratulations :) """ ).lstrip() @@ -278,18 +282,21 @@ def test_allenvs_print_extras(print_extras_stdout_arg): full dev full + dev + full ___________________________________ summary ____________________________________ py36: commands succeeded py37: commands succeeded py38: commands succeeded py39: commands succeeded + py310: commands succeeded congratulations :) """ ).lstrip() assert result.stdout == expected -@pytest.mark.parametrize("toxenv", ["py36", "py37", "py38", "py39"]) +@pytest.mark.parametrize("toxenv", ["py36", "py37", "py38", "py39", "py310"]) def test_print_deps_to_file(toxenv, tmp_path): depspath = tmp_path / "deps" result = tox("-e", toxenv, "--print-deps-to", str(depspath)) @@ -304,7 +311,7 @@ def test_print_deps_to_file(toxenv, tmp_path): assert result.stdout == expected -@pytest.mark.parametrize("toxenv", ["py36", "py37", "py38", "py39"]) +@pytest.mark.parametrize("toxenv", ["py36", "py37", "py38", "py39", "py310"]) def test_print_extras_to_file(toxenv, tmp_path): extraspath = tmp_path / "extras" result = tox("-e", toxenv, "--print-extras-to", str(extraspath)) @@ -323,7 +330,7 @@ def test_print_extras_to_file(toxenv, tmp_path): def test_allenvs_print_deps_to_file(tmp_path, option): depspath = tmp_path / "deps" result = tox(option, str(depspath)) - assert depspath.read_text().splitlines() == ["six", "py"] * 4 + assert depspath.read_text().splitlines() == ["six", "py"] * 5 expected = textwrap.dedent( """ ___________________________________ summary ____________________________________ @@ -331,6 +338,7 @@ def test_allenvs_print_deps_to_file(tmp_path, option): py37: commands succeeded py38: commands succeeded py39: commands succeeded + py310: commands succeeded congratulations :) """ ).lstrip() @@ -341,7 +349,7 @@ def test_allenvs_print_deps_to_file(tmp_path, option): def test_allenvs_print_extras_to_file(tmp_path, option): extraspath = tmp_path / "extras" result = tox(option, str(extraspath)) - assert extraspath.read_text().splitlines() == ["dev", "full"] * 4 + assert extraspath.read_text().splitlines() == ["dev", "full"] * 5 expected = textwrap.dedent( """ ___________________________________ summary ____________________________________ @@ -349,6 +357,7 @@ def test_allenvs_print_extras_to_file(tmp_path, option): py37: commands succeeded py38: commands succeeded py39: commands succeeded + py310: commands succeeded congratulations :) """ ).lstrip() @@ -447,16 +456,17 @@ def test_print_deps_only_print_deps_to_file_are_mutually_exclusive(): assert "cannot be used together" in result.stderr -@needs_py36789 +@needs_py3678910 def test_regular_run(): result = tox() - lines = sorted(result.stdout.splitlines()[:4]) + lines = result.stdout.splitlines()[:5] assert "/.tox/py36 is the exec_prefix" in lines[0] assert "/.tox/py37 is the exec_prefix" in lines[1] assert "/.tox/py38 is the exec_prefix" in lines[2] assert "/.tox/py39 is the exec_prefix" in lines[3] + assert "/.tox/py310 is the exec_prefix" in lines[4] assert "congratulations" in result.stdout - for y in 6, 7, 8, 9: + for y in 6, 7, 8, 9, 10: for pkg in "py", "six", "test": sitelib = DOT_TOX / f"py3{y}/lib/python3.{y}/site-packages" assert sitelib.is_dir() @@ -470,7 +480,7 @@ def test_regular_run_native_toxenv(): assert "congratulations" in result.stdout for pkg in "py", "six", "test": sitelib = ( - DOT_TOX / f"{NATIVE_TOXENV}/lib/python3.{NATIVE_TOXENV[-1]}/site-packages" + DOT_TOX / f"{NATIVE_TOXENV}/{NATIVE_SITE_PACKAGES}" ) assert sitelib.is_dir() assert len(list(sitelib.glob(f"{pkg}-*.dist-info"))) == 1 @@ -565,7 +575,7 @@ def test_regular_recreate_after_print_deps(print_deps_stdout_arg): result = tox("-re", NATIVE_TOXENV) assert result.stdout.splitlines()[0] != NATIVE_EXEC_PREFIX_MSG - sitelib = DOT_TOX / f"{NATIVE_TOXENV}/lib/python3.{NATIVE_TOXENV[-1]}/site-packages" + sitelib = DOT_TOX / f"{NATIVE_TOXENV}/{NATIVE_SITE_PACKAGES}" assert sitelib.is_dir() assert len(list(sitelib.glob("test-*.dist-info"))) == 1 diff --git a/tox.ini b/tox.ini index 2d9e7c2..4450e0f 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ # This information is repeated in .github/workflows/main.yaml # (see https://github.com/fedora-python/tox-github-action/issues/8) -envlist = {py36,py37,py38,py39}-tox{release,master,tox315} +envlist = {py36,py37,py38,py39,py310}-tox{release,master,tox315} [testenv] deps=