From 056e6686bc534c57fc6cd48013ab8977793fc8e1 Mon Sep 17 00:00:00 2001 From: Michel Lind Date: Sep 13 2023 20:41:41 +0000 Subject: Fix for zope-testrunner being invoked with python3 -sP Signed-off-by: Michel Lind --- diff --git a/lazr.config-avoid-python-sP.diff b/lazr.config-avoid-python-sP.diff new file mode 100644 index 0000000..fbe61e2 --- /dev/null +++ b/lazr.config-avoid-python-sP.diff @@ -0,0 +1,32 @@ +Since zope-testrunner is invoked with python3 -sP on Fedora, +it seems to cause an issue because lazr.delegates is in system sitelib +but lazr.config is in buildroot. + +On EPEL 9, where the shebang is python3 -s, this works. + +Sidestep the issue by invoking python -sm zope.testrunner rather than +invoking zope-testrunner via its wrapper + +h/t churchyard +``` +Test-module import failures: +Module: lazr.config.tests.test_config +ModuleNotFoundError: No module named 'lazr.config' +Module: lazr.config.tests.test_docs +ModuleNotFoundError: No module named 'lazr.config' +Test-modules with import problems: + lazr.config.tests.test_config + lazr.config.tests.test_docs +Total: 0 tests, 0 failures, 2 errors and 0 skipped in 0.000 seconds. +``` +--- a/tox.ini ++++ b/tox.ini +@@ -16,7 +16,7 @@ skip_missing_interpreters = True + deps = + zope.testrunner + commands = +- zope-testrunner --test-path src --tests-pattern ^tests {posargs} ++ python -sm zope.testrunner --test-path src --tests-pattern ^tests {posargs} + + [testenv:pre-commit] + # necessary to build the woke linter diff --git a/python-lazr-config.spec b/python-lazr-config.spec index b24c5ff..70b22d8 100644 --- a/python-lazr-config.spec +++ b/python-lazr-config.spec @@ -6,6 +6,9 @@ Summary: Create configuration schemas, and process and validate configura License: LGPL-3.0-only URL: https://launchpad.net/lazr.config Source: %{pypi_source lazr.config} +# /usr/bin/zope-testrunner could not find lazr.config due to lazr.delegates being in +# a different directory *and* being invoked with python -sP +Patch: lazr.config-avoid-python-sP.diff BuildArch: noarch BuildRequires: python3-devel