Repository navigation
Update pyproject.toml and make "pytest" work again 'out-of-the-box' - #108
Cor0n4V1rus wants to merge 1 commit into
Conversation
for those who prefer a 'TL;DR' version :
pyproject.toml
requires this change, so that
pytest
works (again and out-of-the-box).
I admit that
pytest test_cycler.py
would also do it, but I assume my change would be more future proof??
the more complete version :
as of now, a simple
pytest
would yield something like
================================================= test session starts ==================================================
platform linux -- Python 3.14.7, pytest-9.0.3, pluggy-1.6.0
codspeed: 5.0.3 (disabled, mode: walltime, callgraph: enabled, timer_resolution: 1.0ns)
benchmark: 5.2.3 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
Using --randomly-seed=3775818194
rootdir: /tmp/build-bot/cycler-0.12.1
configfile: pyproject.toml
plugins: pytest_httpserver-1.1.5, time-machine-3.4.0, benchmark-5.2.3, xdist-3.8.0, regressions-2.5.0, pyfakefs-6.2.0, sugar-1.1.1, httpbin-2.1.0, codspeed-5.0.3, aspectlib-2.0.0, mock-3.14.1, datadir-1.5.0, trio-0.8.0, rerunfailures-16.6, Faker-40.33.0, hypothesis-6.165.10, xprocess-1.0.2, cov-7.1.0, respx-0.23.1, relaxed-2.0.2, anyio-4.15.0, asyncio-1.4.0, timeout-2.4.0, betamax-0.9.0, randomly-4.1.0
asyncio: mode=Mode.STRICT, debug=False, asyncio_default_fixture_loop_scope=None, asyncio_default_test_loop_scope=function
collected 0 items
USAGE: fetch_doc_results.py CircleCI-build-url
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/main.py", line 318, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> ~~~~^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/main.py", line 371, in _main
INTERNALERROR> config.hook.pytest_collection(session=session)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/pluggy/_hooks.py", line 512, in __call__
INTERNALERROR> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/pluggy/_callers.py", line 167, in _multicall
INTERNALERROR> raise exception
INTERNALERROR> File "/usr/lib/python3.14/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> teardown.throw(exception)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/logging.py", line 788, in pytest_collection
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> teardown.throw(exception)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/warnings.py", line 98, in pytest_collection
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> teardown.throw(exception)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/config/__init__.py", line 1409, in pytest_collection
INTERNALERROR> return (yield)
INTERNALERROR> ^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/pluggy/_callers.py", line 121, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/main.py", line 382, in pytest_collection
INTERNALERROR> session.perform_collect()
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~~~~^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/main.py", line 857, in perform_collect
INTERNALERROR> self.items.extend(self.genitems(node))
INTERNALERROR> ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/main.py", line 1023, in genitems
INTERNALERROR> yield from self.genitems(subnode)
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/main.py", line 1023, in genitems
INTERNALERROR> yield from self.genitems(subnode)
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/main.py", line 1020, in genitems
INTERNALERROR> rep, duplicate = self._collect_one_node(node, handle_dupes)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/main.py", line 883, in _collect_one_node
INTERNALERROR> rep = collect_one_node(node)
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/runner.py", line 576, in collect_one_node
INTERNALERROR> rep: CollectReport = ihook.pytest_make_collect_report(collector=collector)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/pluggy/_hooks.py", line 512, in __call__
INTERNALERROR> return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/pluggy/_callers.py", line 167, in _multicall
INTERNALERROR> raise exception
INTERNALERROR> File "/usr/lib/python3.14/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR> teardown.throw(exception)
INTERNALERROR> ~~~~~~~~~~~~~~^^^^^^^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/capture.py", line 880, in pytest_make_collect_report
INTERNALERROR> rep = yield
INTERNALERROR> ^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/pluggy/_callers.py", line 121, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/runner.py", line 400, in pytest_make_collect_report
INTERNALERROR> call = CallInfo.from_call(
INTERNALERROR> collect, "collect", reraise=(KeyboardInterrupt, SystemExit)
INTERNALERROR> )
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/runner.py", line 353, in from_call
INTERNALERROR> result: TResult | None = func()
INTERNALERROR> ~~~~^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/runner.py", line 398, in collect
INTERNALERROR> return list(collector.collect())
INTERNALERROR> ~~~~~~~~~~~~~~~~~^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/pytest_relaxed/classes.py", line 82, in collect
INTERNALERROR> items = super().collect()
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/python.py", line 563, in collect
INTERNALERROR> self._register_setup_module_fixture()
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/python.py", line 576, in _register_setup_module_fixture
INTERNALERROR> self.obj, ("setUpModule", "setup_module")
INTERNALERROR> ^^^^^^^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/python.py", line 289, in obj
INTERNALERROR> self._obj = obj = self._getobj()
INTERNALERROR> ~~~~~~~~~~~~^^
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/python.py", line 560, in _getobj
INTERNALERROR> return importtestmodule(self.path, self.config)
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/python.py", line 507, in importtestmodule
INTERNALERROR> mod = import_path(
INTERNALERROR> path,
INTERNALERROR> ...<2 lines>...
INTERNALERROR> consider_namespace_packages=config.getini("consider_namespace_packages"),
INTERNALERROR> )
INTERNALERROR> File "/usr/lib/python3.14/site-packages/_pytest/pathlib.py", line 587, in import_path
INTERNALERROR> importlib.import_module(module_name)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
INTERNALERROR> File "/usr/lib/python3.14/importlib/__init__.py", line 88, in import_module
INTERNALERROR> return _bootstrap._gcd_import(name[level:], package, level)
INTERNALERROR> ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR> File "<frozen importlib._bootstrap>", line 1406, in _gcd_import
INTERNALERROR> File "<frozen importlib._bootstrap>", line 1371, in _find_and_load
INTERNALERROR> File "<frozen importlib._bootstrap>", line 1342, in _find_and_load_unlocked
INTERNALERROR> File "<frozen importlib._bootstrap>", line 938, in _load_unlocked
INTERNALERROR> File "<frozen importlib._bootstrap_external>", line 759, in exec_module
INTERNALERROR> File "<frozen importlib._bootstrap>", line 491, in _call_with_frames_removed
INTERNALERROR> File "/tmp/build-bot/cycler-0.12.1/.circleci/fetch_doc_logs.py", line 30, in <module>
INTERNALERROR> sys.exit(1)
INTERNALERROR> ~~~~~~~~^^^
INTERNALERROR> SystemExit: 1
mainloop: caught unexpected SystemExit!
================================================ no tests ran in 0.02s =================================================
As a side note :
This error appears in various python packages and is annoying for Distribution Administrators, when I consider it's quite easy to fix.
|
Thanks for the PR. Why exactly does this fail / why is the change necessary? In a quick test on a slightly different configuration it works on main (platform win32 -- Python 3.15.0, pytest-9.1.1, pluggy-1.6.0) - and as far as I understand pytest's test discovery it should work. |
|
I cannot say why it happens, but it does happen with quite a few python packages (you could check my other python-related repos for patches of them - doesn't matter, if pyproject.toml or setup.cfg would require a change, if any, and mostly it happens with older packages). I'm not a python specialist, but building packages from source for a distribution semi-automatically, hence it raises a red flag by the buildbot. Maybe an installation and use of the pytest package via the official wheel is different to an installation from source? Actually I really should check this out via a "diff -ru" of the two variants, but I guess someone who is deeply into python would know it better and for sure. Reading the test discovery document also leaves me puzzled; currently, for this distribution release of mine, pytest 9.0.3 is used/installed. What I inferred from the other packages I wrote patches for, is, that at least something was changed in the behaviour of pytest between the release date of those packages and before more recent pytest releases, assuming that back then, a simple "pytest" worked. |
for those who prefer a 'TL;DR' version :
requires this change, so that
works (again and out-of-the-box).
I admit that
would also do it, but I assume my change would be more future proof??
the more complete version :
as of now, a simple
pytest
would yield something like
As a side note :
This error appears in various python packages and is annoying for Distribution Administrators, when I consider it's quite easy to fix.