Backport patch and skip test to make package build with Python 3.12

This commit is contained in:
Tomáš Hrnčiar 2023-03-24 14:22:00 +01:00
parent 7ab9535644
commit d1138e0aa2
2 changed files with 33 additions and 1 deletions

25
570.patch Normal file
View File

@ -0,0 +1,25 @@
From f6f260f97df29500a531baf1b370c3e4e4f3dc76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= <thrnciar@redhat.com>
Date: Thu, 23 Mar 2023 13:23:12 +0100
Subject: [PATCH] Replace TestCase method aliases removed in Python 3.12
Fixes: #568
---
CHANGELOG.md | 2 ++
CONTRIBUTORS.md | 1 +
fs/test.py | 2 +-
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/fs/test.py b/fs/test.py
index 32e6ea5c..9bfe811d 100644
--- a/fs/test.py
+++ b/fs/test.py
@@ -1082,7 +1082,7 @@ def test_remove(self):
self.fs.makedirs("foo/bar/baz/")
error_msg = "resource 'foo/bar/egg/test.txt' not found"
- assertRaisesRegex = getattr(self, "assertRaisesRegex", self.assertRaisesRegexp)
+ assertRaisesRegex = getattr(self, "assertRaisesRegex", self.assertRaisesRegex)
with assertRaisesRegex(errors.ResourceNotFound, error_msg):
self.fs.remove("foo/bar/egg/test.txt")

View File

@ -12,6 +12,11 @@ License: MIT
URL: https://pypi.org/project/fs/
Source0: https://github.com/PyFilesystem/pyfilesystem2/archive/v%{version}/%{srcname}-%{version}.tar.gz
# Replace TestCase method aliases removed in Python 3.12
# https://github.com/PyFilesystem/pyfilesystem2/pull/570
# changelog fragment removed to avoid conflict
Patch: 570.patch
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3-setuptools
@ -49,7 +54,9 @@ Summary: %{summary}
%if %{with tests}
%check
# tests/test_ftpfs.py needs pyftpdlib (not packaged yet)
%{python3} -m pytest --ignore tests/test_ftpfs.py
# test_seek_current and test_seek_end are skipped due to regression in Python 3.12
# upstream issue: https://github.com/python/cpython/issues/102956
%{python3} -m pytest --ignore tests/test_ftpfs.py -k "not test_seek_current and not test_seek_end"
%endif
%files -n python3-%{srcname}