From 1e9890065d1f7244635bda5082c68a163b9398ff Mon Sep 17 00:00:00 2001 From: Adriane Boyd Date: Wed, 13 Sep 2023 10:19:24 +0200 Subject: [PATCH] Update warning and tests for python 3.12 --- .github/workflows/tests.yml | 2 +- weasel/tests/cli/test_cli.py | 7 +++++++ weasel/tests/cli/test_cli_app.py | 4 ++++ weasel/tests/cli/test_remote.py | 4 ++++ weasel/util/filesystem.py | 2 +- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5f6016b..54e22a9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -52,7 +52,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python_version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python_version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] include: - os: ubuntu-20.04 python_version: "3.6" diff --git a/weasel/tests/cli/test_cli.py b/weasel/tests/cli/test_cli.py index 9e89534..c554e2e 100644 --- a/weasel/tests/cli/test_cli.py +++ b/weasel/tests/cli/test_cli.py @@ -1,4 +1,5 @@ import os +import sys import time import pytest @@ -113,6 +114,9 @@ def test_is_subpath_of(parent, child, expected): assert is_subpath_of(parent, child) == expected +@pytest.mark.skipif( + sys.version_info >= (3, 12), reason="Python 3.12+ not supported for remotes" +) def test_local_remote_storage(): with make_tempdir() as d: filename = "a.txt" @@ -158,6 +162,9 @@ def test_local_remote_storage(): assert file_.read() == content +@pytest.mark.skipif( + sys.version_info >= (3, 12), reason="Python 3.12+ not supported for remotes" +) def test_local_remote_storage_pull_missing(): # pulling from a non-existent remote pulls nothing gracefully with make_tempdir() as d: diff --git a/weasel/tests/cli/test_cli_app.py b/weasel/tests/cli/test_cli_app.py index cc77784..311dbf7 100644 --- a/weasel/tests/cli/test_cli_app.py +++ b/weasel/tests/cli/test_cli_app.py @@ -1,3 +1,4 @@ +import sys from pathlib import Path from typing import Any, Dict @@ -163,6 +164,9 @@ def test_project_clone(tmp_path: Path, options_string: str): assert (out / "README.md").is_file() +@pytest.mark.skipif( + sys.version_info >= (3, 12), reason="Python 3.12+ not supported for remotes" +) def test_project_push_pull(tmp_path: Path, project_dir: Path): proj = dict(SAMPLE_PROJECT) remote = "xyz" diff --git a/weasel/tests/cli/test_remote.py b/weasel/tests/cli/test_remote.py index b351b90..ab03221 100644 --- a/weasel/tests/cli/test_remote.py +++ b/weasel/tests/cli/test_remote.py @@ -1,3 +1,4 @@ +import sys from pathlib import Path import pytest @@ -9,6 +10,9 @@ runner = CliRunner() +if sys.version_info >= (3, 12): + pytest.skip("Python 3.12+ not supported for remotes", allow_module_level=True) + @pytest.fixture def project_dir(tmp_path_factory: pytest.TempPathFactory): diff --git a/weasel/util/filesystem.py b/weasel/util/filesystem.py index 307901e..c483ea6 100644 --- a/weasel/util/filesystem.py +++ b/weasel/util/filesystem.py @@ -80,7 +80,7 @@ def ensure_pathy(path): except ImportError as e: import sys - if sys.version >= (3, 12): + if sys.version_info >= (3, 12): warnings.warn(Warnings.W802) raise e