- Add patch stop-using-imp.patch:
* Use importlib and not imp. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-shutil?expand=0&rev=24
This commit is contained in:
parent
e3e23cea9f
commit
62a2e771c9
@ -1,3 +1,9 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jan 24 04:48:42 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Add patch stop-using-imp.patch:
|
||||||
|
* Use importlib and not imp.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sat Jun 10 11:50:04 UTC 2023 - ecsos <ecsos@opensuse.org>
|
Sat Jun 10 11:50:04 UTC 2023 - ecsos <ecsos@opensuse.org>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-pytest-shutil
|
# 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
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -26,7 +26,9 @@ License: MIT
|
|||||||
URL: https://github.com/manahl/pytest-plugins
|
URL: https://github.com/manahl/pytest-plugins
|
||||||
Source: https://files.pythonhosted.org/packages/source/p/pytest-shutil/pytest-shutil-%{version}.tar.gz
|
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
|
# 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 execnet}
|
||||||
BuildRequires: %{python_module path}
|
BuildRequires: %{python_module path}
|
||||||
BuildRequires: %{python_module pytest}
|
BuildRequires: %{python_module pytest}
|
||||||
|
36
stop-using-imp.patch
Normal file
36
stop-using-imp.patch
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
From bbb9e5c7cba84fb4665a521569d1cfcca08ee4e5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
|
||||||
|
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):
|
Loading…
x
Reference in New Issue
Block a user