diff --git a/python-pytest-shutil.changes b/python-pytest-shutil.changes index 05bfd14..6544f2a 100644 --- a/python-pytest-shutil.changes +++ b/python-pytest-shutil.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jan 24 04:48:42 UTC 2024 - Steve Kowalik + +- Add patch stop-using-imp.patch: + * Use importlib and not imp. + ------------------------------------------------------------------- Sat Jun 10 11:50:04 UTC 2023 - ecsos diff --git a/python-pytest-shutil.spec b/python-pytest-shutil.spec index a67b1d3..7bb45d0 100644 --- a/python-pytest-shutil.spec +++ b/python-pytest-shutil.spec @@ -1,7 +1,7 @@ # # spec file for package python-pytest-shutil # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -26,7 +26,9 @@ License: MIT URL: https://github.com/manahl/pytest-plugins Source: https://files.pythonhosted.org/packages/source/p/pytest-shutil/pytest-shutil-%{version}.tar.gz # PATCH-FEATURE-UPSTREAM pytest-fixtures-pr171-remove-mock.patch -- gh#man-group#pytest-plugins#171 -Patch1: pytest-fixtures-pr171-remove-mock.patch +Patch0: pytest-fixtures-pr171-remove-mock.patch +# PATCH-FIX-UPSTREAM gh#man-group/pytest-plugins#219 +Patch1: stop-using-imp.patch BuildRequires: %{python_module execnet} BuildRequires: %{python_module path} BuildRequires: %{python_module pytest} diff --git a/stop-using-imp.patch b/stop-using-imp.patch new file mode 100644 index 0000000..05122ba --- /dev/null +++ b/stop-using-imp.patch @@ -0,0 +1,36 @@ +From bbb9e5c7cba84fb4665a521569d1cfcca08ee4e5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= +Date: Sat, 27 May 2023 18:05:44 +0200 +Subject: [PATCH] pytest-shutil: Replace deprecated imp module + +Replace the use of the deprecated `imp` module with `importlib.util', +as the former has been removed from Python 3.12. +--- + pytest-shutil/pytest_shutil/run.py | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/pytest-shutil/pytest_shutil/run.py b/pytest-shutil/pytest_shutil/run.py +index 7d46aea1..08a6a34c 100644 +--- a/pytest-shutil/pytest_shutil/run.py ++++ b/pytest-shutil/pytest_shutil/run.py +@@ -3,7 +3,7 @@ + """ + import sys + import os +-import imp ++import importlib.util + import logging + from functools import update_wrapper + import inspect +@@ -112,7 +112,10 @@ def run_module_as_main(module, argv=[]): + filename = os.path.splitext(filename)[0] + ".py" + + with patch("sys.argv", new=argv): +- imp.load_source('__main__', os.path.join(where, filename)) ++ spec = importlib.util.spec_from_file_location( ++ "__main__", os.path.join(where, filename)) ++ module = importlib.util.module_from_spec(spec) ++ spec.loader.exec_module(module) + + + def _evaluate_fn_source(src, *args, **kwargs):