GrahamDumpleton / wrapt

A Python module for decorators, wrappers and monkey patching.
BSD 2-Clause "Simplified" License
2.06k stars 231 forks source link

1.16.0: pytest fails #262

Open kloczek opened 8 months ago

kloczek commented 8 months ago

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

Looks like pytest 8.1.0 fails (I'm using python 3.9).

Here is pytest output: ```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-wrapt-1.16.0-4.fc36.x86_64/usr/lib64/python3.9/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-wrapt-1.16.0-4.fc36.x86_64/usr/lib/python3.9/site-packages + /usr/bin/pytest -ra -m 'not network' Traceback (most recent call last): File "/usr/bin/pytest", line 8, in sys.exit(console_main()) File "/usr/lib/python3.9/site-packages/_pytest/config/__init__.py", line 195, in console_main code = main() File "/usr/lib/python3.9/site-packages/_pytest/config/__init__.py", line 153, in main config = _prepareconfig(args, plugins) File "/usr/lib/python3.9/site-packages/_pytest/config/__init__.py", line 335, in _prepareconfig config = pluginmanager.hook.pytest_cmdline_parse( File "/usr/lib/python3.9/site-packages/pluggy/_hooks.py", line 501, in __call__ return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult) File "/usr/lib/python3.9/site-packages/pluggy/_manager.py", line 119, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) File "/usr/lib/python3.9/site-packages/pluggy/_callers.py", line 138, in _multicall raise exception.with_traceback(exception.__traceback__) File "/usr/lib/python3.9/site-packages/pluggy/_callers.py", line 121, in _multicall teardown.throw(exception) # type: ignore[union-attr] File "/usr/lib/python3.9/site-packages/_pytest/helpconfig.py", line 105, in pytest_cmdline_parse config = yield File "/usr/lib/python3.9/site-packages/pluggy/_callers.py", line 102, in _multicall res = hook_impl.function(*args) File "/usr/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1141, in pytest_cmdline_parse self.parse(args) File "/usr/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1490, in parse self._preparse(args, addopts=addopts) File "/usr/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1394, in _preparse self.hook.pytest_load_initial_conftests( File "/usr/lib/python3.9/site-packages/pluggy/_hooks.py", line 501, in __call__ return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult) File "/usr/lib/python3.9/site-packages/pluggy/_manager.py", line 119, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) File "/usr/lib/python3.9/site-packages/pluggy/_callers.py", line 138, in _multicall raise exception.with_traceback(exception.__traceback__) File "/usr/lib/python3.9/site-packages/pluggy/_callers.py", line 121, in _multicall teardown.throw(exception) # type: ignore[union-attr] File "/usr/lib/python3.9/site-packages/_pytest/warnings.py", line 150, in pytest_load_initial_conftests return (yield) File "/usr/lib/python3.9/site-packages/pluggy/_callers.py", line 121, in _multicall teardown.throw(exception) # type: ignore[union-attr] File "/usr/lib/python3.9/site-packages/_pytest/capture.py", line 153, in pytest_load_initial_conftests yield File "/usr/lib/python3.9/site-packages/pluggy/_callers.py", line 102, in _multicall res = hook_impl.function(*args) File "/usr/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1219, in pytest_load_initial_conftests self.pluginmanager._set_initial_conftests( File "/usr/lib/python3.9/site-packages/_pytest/config/__init__.py", line 577, in _set_initial_conftests self._try_load_conftest( File "/usr/lib/python3.9/site-packages/_pytest/config/__init__.py", line 625, in _try_load_conftest self._loadconftestmodules( File "/usr/lib/python3.9/site-packages/_pytest/config/__init__.py", line 655, in _loadconftestmodules mod = self._importconftest( File "/usr/lib/python3.9/site-packages/_pytest/config/__init__.py", line 731, in _importconftest self.consider_conftest(mod, registration_name=conftestpath_plugin_name) File "/usr/lib/python3.9/site-packages/_pytest/config/__init__.py", line 812, in consider_conftest self.register(conftestmodule, name=registration_name) File "/usr/lib/python3.9/site-packages/_pytest/config/__init__.py", line 497, in register plugin_name = super().register(plugin, name) File "/usr/lib/python3.9/site-packages/pluggy/_manager.py", line 167, in register self._verify_hook(hook, hookimpl) File "/usr/lib/python3.9/site-packages/pluggy/_manager.py", line 342, in _verify_hook raise PluginValidationError( pluggy._manager.PluginValidationError: Plugin '/home/tkloczko/rpmbuild/BUILD/wrapt-1.16.0/tests/conftest.py' for hook 'pytest_pycollect_makemodule' hookimpl definition: pytest_pycollect_makemodule(path, parent) Argument(s) {'path'} are declared in the hookimpl but can not be found in the hookspec ```

Please let me know if you need more details or want me to perform some diagnostics.

GrahamDumpleton commented 1 month ago

Sorry only finally looking at this now. Since I don't know anything about RPM packaging and how builds/tests are done with it, this is all very much gobbledygook to me. Did you work out anything else about this to resolve it or understand what may need to change in wrapt?

kloczek commented 1 month ago

This issue has nothing to to with rpm or packaging methodology.

GrahamDumpleton commented 1 month ago

You are using some PyPA build package though, which I have never encountered before and so the errors don't mean anything to me. So any further information you worked out about this will help either way.

GrahamDumpleton commented 1 month ago

Although technically your problem is actually then with later step of running pytest. FWIW, I always run tests under tox and never use pytest directly. The current test configuration for tox was contributed by others, so don't know if there is anything special being done which may means doesn't work outside of tox.

kloczek commented 1 month ago

In build env ae installed ONLY build dependencies so it does not make to run pytest under tox. Build env is created from scratch to build only one package and after that is never reused.. Why pytest may not work without tox if in in both cases will be installed exactly the same modules? I have already packages +1.2k python modules and on NONE of the cases pytest has been working differently (with and without tox)