mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-09-24 04:59:14 -07:00
dev-python/pytest-shutil: Enable py3.12, fix tests
Closes: https://bugs.gentoo.org/888217 Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
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 7d46aea..08a6a34 100644
|
||||
--- a/pytest_shutil/run.py
|
||||
+++ b/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):
|
||||
--
|
||||
2.40.1
|
||||
|
||||
54
dev-python/pytest-shutil/pytest-shutil-1.7.0-r4.ebuild
Normal file
54
dev-python/pytest-shutil/pytest-shutil-1.7.0-r4.ebuild
Normal file
@@ -0,0 +1,54 @@
|
||||
# Copyright 1999-2023 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
DISTUTILS_USE_PEP517=setuptools
|
||||
PYPI_NO_NORMALIZE=1
|
||||
PYTHON_COMPAT=( python3_{10..12} pypy3 )
|
||||
|
||||
inherit distutils-r1 pypi
|
||||
|
||||
DESCRIPTION="A goodie-bag of unix shell and environment tools for py.test"
|
||||
HOMEPAGE="
|
||||
https://github.com/man-group/pytest-plugins/
|
||||
https://pypi.org/project/pytest-shutil/
|
||||
"
|
||||
|
||||
LICENSE="MIT"
|
||||
SLOT="0"
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos"
|
||||
|
||||
RDEPEND="
|
||||
dev-python/pytest[${PYTHON_USEDEP}]
|
||||
dev-python/six[${PYTHON_USEDEP}]
|
||||
dev-python/execnet[${PYTHON_USEDEP}]
|
||||
dev-python/path[${PYTHON_USEDEP}]
|
||||
dev-python/mock[${PYTHON_USEDEP}]
|
||||
dev-python/termcolor[${PYTHON_USEDEP}]
|
||||
"
|
||||
BDEPEND="
|
||||
${RDEPEND}
|
||||
dev-python/setuptools-git[${PYTHON_USEDEP}]
|
||||
"
|
||||
|
||||
distutils_enable_tests pytest
|
||||
|
||||
PATCHES=(
|
||||
# https://github.com/man-group/pytest-plugins/pull/219
|
||||
"${FILESDIR}"/${P}-py312.patch
|
||||
)
|
||||
|
||||
EPYTEST_DESELECT=(
|
||||
# colors no longer happen automagically to non-tty, not important
|
||||
# https://github.com/man-group/pytest-plugins/pull/217
|
||||
tests/unit/test_cmdline.py::test_pretty_formatter
|
||||
)
|
||||
|
||||
python_prepare_all() {
|
||||
# remove unnecessary deps
|
||||
# (contextlib2 is not used in py3)
|
||||
sed -i -e '/path\.py/d' -e '/contextlib2/d' setup.py || die
|
||||
|
||||
distutils-r1_python_prepare_all
|
||||
}
|
||||
Reference in New Issue
Block a user