From 9c9b55b5491541f907cbb6f55ecf58453faa939d Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Mon, 1 Apr 2024 12:30:47 +0200 Subject: [PATCH 1/3] 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 0215aba96..4d11ba779 100644 --- a/testing/_py/test_local.py +++ b/testing/_py/test_local.py @@ -205,10 +205,7 @@ class CommonFSTests: 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): @@ -461,12 +458,10 @@ class CommonFSTests: 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 0cd77dfea55c9fb27d81f110df5a1c0b095a69ba Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Tue, 21 May 2024 09:03:50 +0200 Subject: [PATCH 2/3] 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 c7ab1182f..b19df1297 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 5f1f3aa6f83758d571a1c95d8ed4377d78597a2f Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Mon, 27 May 2024 23:19:43 +0200 Subject: [PATCH 3/3] 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 4d11ba779..36d022fcc 100644 --- a/testing/_py/test_local.py +++ b/testing/_py/test_local.py @@ -205,7 +205,10 @@ class CommonFSTests: 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):