From e65f6f8892d56b3b95cf9749033bd01f82d13f42 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Mon, 1 Apr 2024 12:30:47 +0200 Subject: [PATCH 1/4] Remove all mark.skip for python < 3.8 Co-authored-by: Bruno Oliveira --- testing/_py/test_local.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/testing/_py/test_local.py b/testing/_py/test_local.py index 461b0b599c1..eee14846ef5 100644 --- a/testing/_py/test_local.py +++ b/testing/_py/test_local.py @@ -207,10 +207,7 @@ def test_visit_norecurse(self, path1): assert "sampledir" in lst assert path1.sep.join(["sampledir", "otherfile"]) not in lst - @pytest.mark.parametrize( - "fil", - ["*dir", "*dir", pytest.mark.skip("sys.version_info < (3,6)")(b"*dir")], - ) + @pytest.mark.parametrize("fil", ["*dir", "*dir", b"*dir"]) def test_visit_filterfunc_is_string(self, path1, fil): lst = [] for i in path1.visit(fil): @@ -463,12 +460,10 @@ def test_fspath_func_match_strpath(self, path1): assert fspath(path1) == path1.strpath - @pytest.mark.skip("sys.version_info < (3,6)") def test_fspath_open(self, path1): f = path1.join("opentestfile") open(f) - @pytest.mark.skip("sys.version_info < (3,6)") def test_fspath_fsencode(self, path1): from os import fsencode From 3444664e26469061705a981eae7b07d1f733ebf2 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Tue, 21 May 2024 09:03:50 +0200 Subject: [PATCH 2/4] Fix a base string usage that need to also take bytes into account --- src/_pytest/_py/path.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/_py/path.py b/src/_pytest/_py/path.py index e353c1a9b52..c6d343bbb09 100644 --- a/src/_pytest/_py/path.py +++ b/src/_pytest/_py/path.py @@ -137,7 +137,7 @@ class NeverRaised(Exception): class Visitor: def __init__(self, fil, rec, ignore, bf, sort): - if isinstance(fil, str): + if isinstance(fil, (str, bytes)): fil = FNMatcher(fil) if isinstance(rec, str): self.rec: Callable[[LocalPath], bool] = FNMatcher(rec) From 78b992fea848006d2fe66b7a69e91b3d7bd9ed79 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Mon, 27 May 2024 23:19:43 +0200 Subject: [PATCH 3/4] Put back the original test intent into place using 3.10 instead of 3.8 Taking into account https://github.com/pytest-dev/pytest/pull/12172\#discussion_r1575926834 --- testing/_py/test_local.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/testing/_py/test_local.py b/testing/_py/test_local.py index eee14846ef5..5d291128c52 100644 --- a/testing/_py/test_local.py +++ b/testing/_py/test_local.py @@ -207,7 +207,10 @@ def test_visit_norecurse(self, path1): assert "sampledir" in lst assert path1.sep.join(["sampledir", "otherfile"]) not in lst - @pytest.mark.parametrize("fil", ["*dir", "*dir", b"*dir"]) + @pytest.mark.parametrize( + "fil", + ["*dir", "*dir", pytest.mark.skipif("sys.version_info < (3,10)")(b"*dir")], + ) def test_visit_filterfunc_is_string(self, path1, fil): lst = [] for i in path1.visit(fil): From a5f5100fd79ae67b16dff20c02ccf0c070ca1883 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Wed, 23 Oct 2024 13:32:00 +0200 Subject: [PATCH 4/4] Update testing/_py/test_local.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) --- testing/_py/test_local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/_py/test_local.py b/testing/_py/test_local.py index 5d291128c52..2ab4e16af13 100644 --- a/testing/_py/test_local.py +++ b/testing/_py/test_local.py @@ -209,7 +209,7 @@ def test_visit_norecurse(self, path1): @pytest.mark.parametrize( "fil", - ["*dir", "*dir", pytest.mark.skipif("sys.version_info < (3,10)")(b"*dir")], + ["*dir", "*dir", pytest.mark.skipif(sys.version_info < (3, 10))(b"*dir")], ) def test_visit_filterfunc_is_string(self, path1, fil): lst = []