From 59c803bef0bf9b4f167918783e386c3ddb746751 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 24 May 2023 15:02:35 +0100 Subject: gentoo auto-resync : 24:05:2023 - 15:02:35 --- dev-python/pytest/Manifest | 4 +- dev-python/pytest/files/pytest-7.3.1-py312.patch | 197 +++++++++++++++++++++++ dev-python/pytest/pytest-7.3.1-r1.ebuild | 113 +++++++++++++ dev-python/pytest/pytest-7.3.1.ebuild | 2 +- 4 files changed, 314 insertions(+), 2 deletions(-) create mode 100644 dev-python/pytest/files/pytest-7.3.1-py312.patch create mode 100644 dev-python/pytest/pytest-7.3.1-r1.ebuild (limited to 'dev-python/pytest') diff --git a/dev-python/pytest/Manifest b/dev-python/pytest/Manifest index f2019116d890..5a199127bd31 100644 --- a/dev-python/pytest/Manifest +++ b/dev-python/pytest/Manifest @@ -1,3 +1,5 @@ +AUX pytest-7.3.1-py312.patch 8961 BLAKE2B 74125c002d0450f9f1668b5bc35f5d039b03c3ec12c2dc743ea1870e3ab2f205792f66e78f51df4c23076742466aab08b08c0be5d5ef8e9a983d0519cea9463b SHA512 0d4a47afd1a9533c0a2ace9581a59cf8c4e5a41dea8f3b8e2545cc07e85423aa1ec8e0caa3dd631b8a46202f026d35144f9f2d37677dc798abcdd8c0f037e1f7 DIST pytest-7.3.1.tar.gz 1336938 BLAKE2B 8cabc475056000e393538c6c52e2ee5a9af6c57831c6aba82e3107ae44f88b63a68b37339842eebfa318bd27d4bf5e34959b72052d4646cc8682c84f131f98e7 SHA512 e6c8fcf1449f5e09e33c01ec2ade8812ceb13440324179288b8ca0eeaaffed1e581a65c8acf4c28efe61c19a067e7ceddccc45d8a1582c89259d53fee25ab253 -EBUILD pytest-7.3.1.ebuild 3662 BLAKE2B 097f3af263392c38fb1f55fdea454892a0711749a6a4ee780474b3ca1dab45dd5d4731123ed1d10c02952ee64de54e16d58b107fc6b548f8e81d4d835035523b SHA512 bfb898b1fb39ac42311eff25a130fa50c952f1b5cc0ed7f0ef5148abf26defb3ef1cdf7a4d4a2f44db29095ae3c314e7532e0b81a4bf9f073cb325df71445078 +EBUILD pytest-7.3.1-r1.ebuild 3794 BLAKE2B 85bd38a377a49fd5eba6ab0f4fe86153bf5b83f4e3f879d3cc464d031b4a321ce36eff2ce563bdc50efaf09cf4b1f5e90740e844f0540a95ceda8f4fbb5d54b5 SHA512 fa3ee532ffc8832c20a3aa0f06a0555f22134e5aa0faec71c27a7ad002f7d7b2ff0e3fc87d7b56a67aded5f9535395a9adef695843318ef1f8617db2c51f22dc +EBUILD pytest-7.3.1.ebuild 3651 BLAKE2B cc8f401b17190541d2b64640f4926781966a166eb9590cd96e9d15a2c65602e0183b19b11e4232ca61c5cd951d34c64172695d405459e16d392888a3f20e769b SHA512 689aa388fd46ea97dce4f51a8447f3278398d9c68f79c6db64dcdf1ac2b81a212d4862580ddeae8cdf44786b3eb23b09ac8324e3d47539a413b7cfd962f3e8c9 MISC metadata.xml 391 BLAKE2B 48d31ecb4c8b171ee4e84a58399211368ddc00dfb5dbe0999f96e03d744294cd4fd5263e90600c93d1f13c7da21052faef84b6d0d56709f3559e37b3392ca31d SHA512 6e9caa57eda23995d21df6f52c52d5868e1ff56abb6c1351ffc0fe14b771639473481a2630e659caaff83f0255379aa2d012175af52a0de41221b27d3ab2f425 diff --git a/dev-python/pytest/files/pytest-7.3.1-py312.patch b/dev-python/pytest/files/pytest-7.3.1-py312.patch new file mode 100644 index 000000000000..62a32e0cb7a6 --- /dev/null +++ b/dev-python/pytest/files/pytest-7.3.1-py312.patch @@ -0,0 +1,197 @@ +From b1ba5ff337300e4242fb961d8496474e4b739c9b Mon Sep 17 00:00:00 2001 +From: Ran Benita +Date: Wed, 10 May 2023 10:36:09 +0300 +Subject: [PATCH] Avoid ast deprecation warnings on Python 3.12 + +Fix #10977. +--- + src/_pytest/assertion/rewrite.py | 44 ++++++++++++++++++-------------- + src/_pytest/mark/expression.py | 8 +++++- + 2 files changed, 32 insertions(+), 20 deletions(-) + +diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py +index 8b182347052..2f9038ee132 100644 +--- a/src/_pytest/assertion/rewrite.py ++++ b/src/_pytest/assertion/rewrite.py +@@ -46,8 +46,14 @@ + + if sys.version_info >= (3, 8): + namedExpr = ast.NamedExpr ++ astNameConstant = ast.Constant ++ astStr = ast.Constant ++ astNum = ast.Constant + else: + namedExpr = ast.Expr ++ astNameConstant = ast.NameConstant ++ astStr = ast.Str ++ astNum = ast.Num + + + assertstate_key = StashKey["AssertionState"]() +@@ -680,7 +686,7 @@ def run(self, mod: ast.Module) -> None: + if ( + expect_docstring + and isinstance(item, ast.Expr) +- and isinstance(item.value, ast.Str) ++ and isinstance(item.value, astStr) + ): + doc = item.value.s + if self.is_rewrite_disabled(doc): +@@ -814,7 +820,7 @@ def pop_format_context(self, expl_expr: ast.expr) -> ast.Name: + current = self.stack.pop() + if self.stack: + self.explanation_specifiers = self.stack[-1] +- keys = [ast.Str(key) for key in current.keys()] ++ keys = [astStr(key) for key in current.keys()] + format_dict = ast.Dict(keys, list(current.values())) + form = ast.BinOp(expl_expr, ast.Mod(), format_dict) + name = "@py_format" + str(next(self.variable_counter)) +@@ -868,16 +874,16 @@ def visit_Assert(self, assert_: ast.Assert) -> List[ast.stmt]: + negation = ast.UnaryOp(ast.Not(), top_condition) + + if self.enable_assertion_pass_hook: # Experimental pytest_assertion_pass hook +- msg = self.pop_format_context(ast.Str(explanation)) ++ msg = self.pop_format_context(astStr(explanation)) + + # Failed + if assert_.msg: + assertmsg = self.helper("_format_assertmsg", assert_.msg) + gluestr = "\n>assert " + else: +- assertmsg = ast.Str("") ++ assertmsg = astStr("") + gluestr = "assert " +- err_explanation = ast.BinOp(ast.Str(gluestr), ast.Add(), msg) ++ err_explanation = ast.BinOp(astStr(gluestr), ast.Add(), msg) + err_msg = ast.BinOp(assertmsg, ast.Add(), err_explanation) + err_name = ast.Name("AssertionError", ast.Load()) + fmt = self.helper("_format_explanation", err_msg) +@@ -893,8 +899,8 @@ def visit_Assert(self, assert_: ast.Assert) -> List[ast.stmt]: + hook_call_pass = ast.Expr( + self.helper( + "_call_assertion_pass", +- ast.Num(assert_.lineno), +- ast.Str(orig), ++ astNum(assert_.lineno), ++ astStr(orig), + fmt_pass, + ) + ) +@@ -913,7 +919,7 @@ def visit_Assert(self, assert_: ast.Assert) -> List[ast.stmt]: + variables = [ + ast.Name(name, ast.Store()) for name in self.format_variables + ] +- clear_format = ast.Assign(variables, ast.NameConstant(None)) ++ clear_format = ast.Assign(variables, astNameConstant(None)) + self.statements.append(clear_format) + + else: # Original assertion rewriting +@@ -924,9 +930,9 @@ def visit_Assert(self, assert_: ast.Assert) -> List[ast.stmt]: + assertmsg = self.helper("_format_assertmsg", assert_.msg) + explanation = "\n>assert " + explanation + else: +- assertmsg = ast.Str("") ++ assertmsg = astStr("") + explanation = "assert " + explanation +- template = ast.BinOp(assertmsg, ast.Add(), ast.Str(explanation)) ++ template = ast.BinOp(assertmsg, ast.Add(), astStr(explanation)) + msg = self.pop_format_context(template) + fmt = self.helper("_format_explanation", msg) + err_name = ast.Name("AssertionError", ast.Load()) +@@ -938,7 +944,7 @@ def visit_Assert(self, assert_: ast.Assert) -> List[ast.stmt]: + # Clear temporary variables by setting them to None. + if self.variables: + variables = [ast.Name(name, ast.Store()) for name in self.variables] +- clear = ast.Assign(variables, ast.NameConstant(None)) ++ clear = ast.Assign(variables, astNameConstant(None)) + self.statements.append(clear) + # Fix locations (line numbers/column offsets). + for stmt in self.statements: +@@ -952,20 +958,20 @@ def visit_NamedExpr(self, name: namedExpr) -> Tuple[namedExpr, str]: + # thinks it's acceptable. + locs = ast.Call(self.builtin("locals"), [], []) + target_id = name.target.id # type: ignore[attr-defined] +- inlocs = ast.Compare(ast.Str(target_id), [ast.In()], [locs]) ++ inlocs = ast.Compare(astStr(target_id), [ast.In()], [locs]) + dorepr = self.helper("_should_repr_global_name", name) + test = ast.BoolOp(ast.Or(), [inlocs, dorepr]) +- expr = ast.IfExp(test, self.display(name), ast.Str(target_id)) ++ expr = ast.IfExp(test, self.display(name), astStr(target_id)) + return name, self.explanation_param(expr) + + def visit_Name(self, name: ast.Name) -> Tuple[ast.Name, str]: + # Display the repr of the name if it's a local variable or + # _should_repr_global_name() thinks it's acceptable. + locs = ast.Call(self.builtin("locals"), [], []) +- inlocs = ast.Compare(ast.Str(name.id), [ast.In()], [locs]) ++ inlocs = ast.Compare(astStr(name.id), [ast.In()], [locs]) + dorepr = self.helper("_should_repr_global_name", name) + test = ast.BoolOp(ast.Or(), [inlocs, dorepr]) +- expr = ast.IfExp(test, self.display(name), ast.Str(name.id)) ++ expr = ast.IfExp(test, self.display(name), astStr(name.id)) + return name, self.explanation_param(expr) + + def visit_BoolOp(self, boolop: ast.BoolOp) -> Tuple[ast.Name, str]: +@@ -1001,7 +1007,7 @@ def visit_BoolOp(self, boolop: ast.BoolOp) -> Tuple[ast.Name, str]: + self.push_format_context() + res, expl = self.visit(v) + body.append(ast.Assign([ast.Name(res_var, ast.Store())], res)) +- expl_format = self.pop_format_context(ast.Str(expl)) ++ expl_format = self.pop_format_context(astStr(expl)) + call = ast.Call(app, [expl_format], []) + self.expl_stmts.append(ast.Expr(call)) + if i < levels: +@@ -1013,7 +1019,7 @@ def visit_BoolOp(self, boolop: ast.BoolOp) -> Tuple[ast.Name, str]: + self.statements = body = inner + self.statements = save + self.expl_stmts = fail_save +- expl_template = self.helper("_format_boolop", expl_list, ast.Num(is_or)) ++ expl_template = self.helper("_format_boolop", expl_list, astNum(is_or)) + expl = self.pop_format_context(expl_template) + return ast.Name(res_var, ast.Load()), self.explanation_param(expl) + +@@ -1099,9 +1105,9 @@ def visit_Compare(self, comp: ast.Compare) -> Tuple[ast.expr, str]: + next_expl = f"({next_expl})" + results.append(next_res) + sym = BINOP_MAP[op.__class__] +- syms.append(ast.Str(sym)) ++ syms.append(astStr(sym)) + expl = f"{left_expl} {sym} {next_expl}" +- expls.append(ast.Str(expl)) ++ expls.append(astStr(expl)) + res_expr = ast.Compare(left_res, [op], [next_res]) + self.statements.append(ast.Assign([store_names[i]], res_expr)) + left_res, left_expl = next_res, next_expl +diff --git a/src/_pytest/mark/expression.py b/src/_pytest/mark/expression.py +index f82a81d44c5..9287bcee50c 100644 +--- a/src/_pytest/mark/expression.py ++++ b/src/_pytest/mark/expression.py +@@ -18,6 +18,7 @@ + import dataclasses + import enum + import re ++import sys + import types + from typing import Callable + from typing import Iterator +@@ -26,6 +27,11 @@ + from typing import Optional + from typing import Sequence + ++if sys.version_info >= (3, 8): ++ astNameConstant = ast.Constant ++else: ++ astNameConstant = ast.NameConstant ++ + + __all__ = [ + "Expression", +@@ -132,7 +138,7 @@ def reject(self, expected: Sequence[TokenType]) -> NoReturn: + + def expression(s: Scanner) -> ast.Expression: + if s.accept(TokenType.EOF): +- ret: ast.expr = ast.NameConstant(False) ++ ret: ast.expr = astNameConstant(False) + else: + ret = expr(s) + s.accept(TokenType.EOF, reject=True) diff --git a/dev-python/pytest/pytest-7.3.1-r1.ebuild b/dev-python/pytest/pytest-7.3.1-r1.ebuild new file mode 100644 index 000000000000..9a67884253d9 --- /dev/null +++ b/dev-python/pytest/pytest-7.3.1-r1.ebuild @@ -0,0 +1,113 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYTHON_TESTED=( python3_{10..11} pypy3 ) +PYTHON_COMPAT=( "${PYTHON_TESTED[@]}" python3_12 ) + +inherit distutils-r1 multiprocessing pypi + +DESCRIPTION="Simple powerful testing with Python" +HOMEPAGE=" + https://pytest.org/ + https://github.com/pytest-dev/pytest/ + https://pypi.org/project/pytest/ +" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="test" +RESTRICT="!test? ( test )" + +RDEPEND=" + dev-python/iniconfig[${PYTHON_USEDEP}] + >=dev-python/more-itertools-4.0.0[${PYTHON_USEDEP}] + dev-python/packaging[${PYTHON_USEDEP}] + >=dev-python/pluggy-0.12[${PYTHON_USEDEP}] + $(python_gen_cond_dep ' + >=dev-python/exceptiongroup-1.0.0_rc8[${PYTHON_USEDEP}] + >=dev-python/tomli-1.0.0[${PYTHON_USEDEP}] + ' 3.{9..10}) +" +BDEPEND=" + >=dev-python/setuptools-scm-6.2.3[${PYTHON_USEDEP}] + test? ( + ${RDEPEND} + $(python_gen_cond_dep ' + dev-python/argcomplete[${PYTHON_USEDEP}] + >=dev-python/attrs-19.2.0[${PYTHON_USEDEP}] + >=dev-python/hypothesis-3.56[${PYTHON_USEDEP}] + dev-python/mock[${PYTHON_USEDEP}] + >=dev-python/pygments-2.7.2[${PYTHON_USEDEP}] + dev-python/pytest-xdist[${PYTHON_USEDEP}] + dev-python/requests[${PYTHON_USEDEP}] + dev-python/xmlschema[${PYTHON_USEDEP}] + ' "${PYTHON_TESTED[@]}") + ) +" + +PATCHES=( + # deprecation warning fix + # https://github.com/pytest-dev/pytest/pull/10894/ + "${FILESDIR}/${P}-py312.patch" +) + +src_test() { + # workaround new readline defaults + echo "set enable-bracketed-paste off" > "${T}"/inputrc || die + local -x INPUTRC="${T}"/inputrc + distutils-r1_src_test +} + +python_test() { + if ! has "${EPYTHON}" "${PYTHON_TESTED[@]/_/.}"; then + einfo "Skipping tests on ${EPYTHON}" + return + fi + + local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 + local -x COLUMNS=80 + + local EPYTEST_DESELECT=( + # broken by epytest args + testing/test_warnings.py::test_works_with_filterwarnings + + # tend to be broken by random pytest plugins + # (these tests patch PYTEST_DISABLE_PLUGIN_AUTOLOAD out) + testing/test_helpconfig.py::test_version_less_verbose + testing/test_helpconfig.py::test_version_verbose + testing/test_junitxml.py::test_random_report_log_xdist + testing/test_junitxml.py::test_runs_twice_xdist + testing/test_terminal.py::TestProgressOutputStyle::test_xdist_normal + testing/test_terminal.py::TestProgressOutputStyle::test_xdist_normal_count + testing/test_terminal.py::TestProgressOutputStyle::test_xdist_verbose + testing/test_terminal.py::TestProgressWithTeardown::test_xdist_normal + testing/test_terminal.py::TestTerminalFunctional::test_header_trailer_info + testing/test_terminal.py::TestTerminalFunctional::test_no_header_trailer_info + + # unstable with xdist + testing/test_terminal.py::TestTerminalFunctional::test_verbose_reporting_xdist + + # TODO (XPASS) + testing/test_debugging.py::TestDebuggingBreakpoints::test_pdb_not_altered + testing/test_debugging.py::TestPDB::test_pdb_interaction_capturing_simple + testing/test_debugging.py::TestPDB::test_pdb_interaction_capturing_twice + testing/test_debugging.py::TestPDB::test_pdb_with_injected_do_debug + testing/test_debugging.py::test_pdb_suspends_fixture_capturing + + # setuptools warnings + testing/acceptance_test.py::TestInvocationVariants::test_cmdline_python_namespace_package + ) + + [[ ${EPYTHON} == pypy3 ]] && EPYTEST_DESELECT+=( + # regressions on pypy3.9 + # https://github.com/pytest-dev/pytest/issues/9787 + testing/test_skipping.py::test_errors_in_xfail_skip_expressions + testing/test_unraisableexception.py + ) + + epytest -p xdist -n "$(makeopts_jobs)" +} diff --git a/dev-python/pytest/pytest-7.3.1.ebuild b/dev-python/pytest/pytest-7.3.1.ebuild index c7ec76740a28..bfaa2a889c08 100644 --- a/dev-python/pytest/pytest-7.3.1.ebuild +++ b/dev-python/pytest/pytest-7.3.1.ebuild @@ -5,7 +5,7 @@ EAPI=8 DISTUTILS_USE_PEP517=setuptools PYTHON_TESTED=( python3_{10..11} pypy3 ) -PYTHON_COMPAT=( "${PYTHON_TESTED[@]}" python3_12 ) +PYTHON_COMPAT=( "${PYTHON_TESTED[@]}" ) inherit distutils-r1 multiprocessing pypi -- cgit v1.2.3