Fix build for Python 3.11
This commit is contained in:
parent
b62f2ef2bc
commit
4132cc9835
55
9800.patch
Normal file
55
9800.patch
Normal file
@ -0,0 +1,55 @@
|
||||
From 0ebfa1d76dc09e075b854176873127553e6dfa1b Mon Sep 17 00:00:00 2001
|
||||
From: Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
|
||||
Date: Sun, 20 Mar 2022 21:01:26 -0700
|
||||
Subject: [PATCH] Fix CI for Python 3.11
|
||||
|
||||
Getting the current working directory has no side-effects, so these context managers were no-ops.
|
||||
Discovered because Path.__enter__ is deprecated in Python 3.11, for removal in 3.13.
|
||||
---
|
||||
testing/test_collection.py | 12 ++++--------
|
||||
1 file changed, 4 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/testing/test_collection.py b/testing/test_collection.py
|
||||
index a943a44d22..aa3bf7ba58 100644
|
||||
--- a/testing/test_collection.py
|
||||
+++ b/testing/test_collection.py
|
||||
@@ -660,8 +660,7 @@ def test_pkgfile(self, pytester: Pytester) -> None:
|
||||
subdir = tmp_path.joinpath("subdir")
|
||||
x = ensure_file(subdir / "x.py")
|
||||
ensure_file(subdir / "__init__.py")
|
||||
- with subdir.cwd():
|
||||
- config = pytester.parseconfigure(x)
|
||||
+ config = pytester.parseconfigure(x)
|
||||
col = pytester.getnode(config, x)
|
||||
assert col is not None
|
||||
assert col.name == "x.py"
|
||||
@@ -1188,8 +1187,7 @@ def test_1():
|
||||
"""
|
||||
% (str(subdir),)
|
||||
)
|
||||
- with pytester.path.cwd():
|
||||
- result = pytester.runpytest()
|
||||
+ result = pytester.runpytest()
|
||||
result.stdout.fnmatch_lines(["*1 passed in*"])
|
||||
assert result.ret == 0
|
||||
|
||||
@@ -1200,8 +1198,7 @@ def test_1():
|
||||
testpaths = .
|
||||
"""
|
||||
)
|
||||
- with pytester.path.cwd():
|
||||
- result = pytester.runpytest("--collect-only")
|
||||
+ result = pytester.runpytest("--collect-only")
|
||||
result.stdout.fnmatch_lines(["collected 1 item"])
|
||||
|
||||
|
||||
@@ -1224,8 +1221,7 @@ def test_collect_pyargs_with_testpaths(
|
||||
)
|
||||
)
|
||||
monkeypatch.setenv("PYTHONPATH", str(pytester.path), prepend=os.pathsep)
|
||||
- with root.cwd():
|
||||
- result = pytester.runpytest_subprocess()
|
||||
+ result = pytester.runpytest_subprocess()
|
||||
result.stdout.fnmatch_lines(["*1 passed in*"])
|
||||
|
||||
|
@ -8,6 +8,14 @@ License: MIT
|
||||
URL: https://pytest.org
|
||||
Source: %{pypi_source pytest %{base_version}%{?prerelease}}
|
||||
|
||||
# Fix build for Python 3.11
|
||||
# Fixes https://bugzilla.redhat.com/2069153
|
||||
# Merged upstream
|
||||
# Getting the current working directory has no side-effects,
|
||||
# so these context managers were no-ops.
|
||||
# Tests failed because Path.__enter__ is deprecated in Python 3.11.
|
||||
Patch: https://github.com/pytest-dev/pytest/pull/9800.patch
|
||||
|
||||
# When building pytest for the first time with new Python version
|
||||
# we might not yet have all the BRs, those conditionals allow us to do that.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user