Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.16.0: pytest fails #262

Open
kloczek opened this issue Mar 9, 2024 · 5 comments
Open

1.16.0: pytest fails #262

kloczek opened this issue Mar 9, 2024 · 5 comments

Comments

@kloczek
Copy link

kloczek commented Mar 9, 2024

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.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix> using installer module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

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

Here is pytest output:
+ 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 <module>
    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
Copy link
Owner

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
Copy link
Author

kloczek commented Oct 6, 2024

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

@GrahamDumpleton
Copy link
Owner

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
Copy link
Owner

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
Copy link
Author

kloczek commented Oct 7, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants