* [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: testdata/repos/python/PythonCheck/MisplacedEPyTestVar/, src/pkgcheck/checks/
@ 2025-07-21 5:49 Arthur Zamarin
0 siblings, 0 replies; only message in thread
From: Arthur Zamarin @ 2025-07-21 5:49 UTC (permalink / raw
To: gentoo-commits
commit: 5beaecdbd744b5166929341cd05164b201ac2dbf
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 21 02:54:18 2025 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Mon Jul 21 05:49:11 2025 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=5beaecdb
Fix `MisplacedEPyTestVar` check with no `distutils_enable_tests`
Reported by @parona-source.
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
Closes: https://github.com/pkgcore/pkgcheck/pull/751
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/python.py | 6 +++--
.../MisplacedEPyTestVar-1.ebuild | 29 ++++++++++++++++++++++
2 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/src/pkgcheck/checks/python.py b/src/pkgcheck/checks/python.py
index 71a25f91..281df257 100644
--- a/src/pkgcheck/checks/python.py
+++ b/src/pkgcheck/checks/python.py
@@ -441,6 +441,7 @@ class PythonCheck(Check):
def check_epytest_vars(self, pkg):
"""Check for incorrect use of EPYTEST_* variables"""
# TODO: do we want to check for multiple det calls? Quite unlikely.
+ det_lineno = None
for node in pkg.global_query(bash.cmd_query):
name = pkg.node_str(node.child_by_field_name("name"))
if name != "distutils_enable_tests":
@@ -454,8 +455,9 @@ class PythonCheck(Check):
break
elif argument != "\\":
return
- else:
- return
+
+ if det_lineno is None:
+ return
for var_name, var_node in self._get_all_global_assignments(pkg):
# While not all variables affect distutils_enable_tests, make it
diff --git a/testdata/repos/python/PythonCheck/MisplacedEPyTestVar/MisplacedEPyTestVar-1.ebuild b/testdata/repos/python/PythonCheck/MisplacedEPyTestVar/MisplacedEPyTestVar-1.ebuild
new file mode 100644
index 00000000..0e30f6c4
--- /dev/null
+++ b/testdata/repos/python/PythonCheck/MisplacedEPyTestVar/MisplacedEPyTestVar-1.ebuild
@@ -0,0 +1,29 @@
+EAPI=8
+
+DISTUTILS_USE_PEP517=flit
+PYTHON_COMPAT=( python3_10 )
+
+inherit distutils-r1
+
+DESCRIPTION="Ebuild with misplaced EPYTEST vars"
+HOMEPAGE="https://github.com/pkgcore/pkgcheck"
+LICENSE="BSD"
+SLOT="0"
+
+EPYTEST_PLUGIN_AUTOLOAD=1
+EPYTEST_PLUGINS=( foo bar baz )
+EPYTEST_XDIST=1
+: ${EPYTEST_TIMEOUT:=180}
+
+EPYTEST_DESELECT=(
+ tests/test_foo.py::test_foo
+)
+EPYTEST_IGNORE=(
+ tests/test_bar.py
+)
+
+python_test() {
+ : ${EPYTEST_TIMEOUT:=300}
+ local EPYTEST_PLUGINS=( "${EPYTEST_PLUGINS[@]}" more )
+ EPYTEST_XDIST= epytest
+}
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-07-21 5:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-21 5:49 [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: testdata/repos/python/PythonCheck/MisplacedEPyTestVar/, src/pkgcheck/checks/ Arthur Zamarin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox