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.32: pytest is failing #268

Open
kloczek opened this issue Sep 28, 2022 · 3 comments
Open

1.32: pytest is failing #268

kloczek opened this issue Sep 28, 2022 · 3 comments

Comments

@kloczek
Copy link

kloczek commented Sep 28, 2022

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>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-teamcity-messages-1.32-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-teamcity-messages-1.32-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.14, pytest-7.1.3, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/teamcity-messages-1.32
plugins: teamcity-messages-1.32
collected 0 items / 1 error

================================================================================== ERRORS ==================================================================================
______________________________________________________________________ ERROR collecting test session _______________________________________________________________________
Direct construction of conftest.YamlFile has been deprecated, please use conftest.YamlFile.from_parent.
See https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent for more details.
============================================================================= warnings summary =============================================================================
tests/guinea-pigs/pytest/custom/conftest.py:5
  /home/tkloczko/rpmbuild/BUILD/teamcity-messages-1.32/tests/guinea-pigs/pytest/custom/conftest.py:5: PytestRemovedIn8Warning: The (fspath: py.path.local) argument to YamlFile is deprecated. Please use the (path: pathlib.Path) argument instead.
  See https://docs.pytest.org/en/latest/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path
    return YamlFile.from_parent(parent, fspath=path)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================= short test summary info ==========================================================================

Here is list of installed modules in build env

Package         Version
--------------- --------------
appdirs         1.4.4
attrs           22.1.0
Brlapi          0.8.3
build           0.8.0
codespell       2.2.1
cssselect       1.1.0
cycler          0.11.0
distro          1.7.0
dnspython       2.2.1
extras          1.0.0
fixtures        4.0.0
fonttools       4.37.3
gpg             1.17.1-unknown
iniconfig       1.1.1
kiwisolver      1.4.4
libcomps        0.1.19
louis           3.23.0
lxml            4.9.1
matplotlib      3.5.3
numpy           1.23.1
olefile         0.46
packaging       21.3
pbr             5.9.0
pep517          0.12.0
Pillow          9.2.0
pip             22.2.2
pluggy          1.0.0
py              1.11.0
PyGObject       3.42.2
pyparsing       3.0.9
pytest          7.1.3
python-dateutil 2.8.2
rpm             4.17.0
scour           0.38.2
setuptools      65.4.0
six             1.16.0
testtools       2.5.0
tomli           2.0.1
wheel           0.37.1
@kloczek
Copy link
Author

kloczek commented Sep 28, 2022

BTW in tox.ini I see use setuptools test. That is already marked as deprecated pypa/setuptools#1684

@kloczek
Copy link
Author

kloczek commented Jan 27, 2024

Gentle ping .. any update? 🤔

@kloczek
Copy link
Author

kloczek commented Jun 24, 2024

With python 3.10 and pytest 8.2.2 is now even worse

Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-teamcity-messages-1.32-8.fc37.x86_64/usr/lib64/python3.10/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-teamcity-messages-1.32-8.fc37.x86_64/usr/lib/python3.10/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.10.14, pytest-8.2.2, pluggy-1.5.0
rootdir: /home/tkloczko/rpmbuild/BUILD/teamcity-messages-1.32
plugins: teamcity-messages-1.32
collected 28 items / 8 errors / 1 skipped
usage: pytest [-h] [-v] [-q] [--locals] [-f] [-c] [-b] [-k TESTNAMEPATTERNS]
              [tests ...]
pytest: error: unrecognized arguments: -ra -m
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 292, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 345, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_hooks.py", line 513, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR>     teardown.throw(exception)  # type: ignore[union-attr]
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/logging.py", line 794, in pytest_collection
INTERNALERROR>     return (yield)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR>     teardown.throw(exception)  # type: ignore[union-attr]
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/warnings.py", line 120, in pytest_collection
INTERNALERROR>     return (yield)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR>     teardown.throw(exception)  # type: ignore[union-attr]
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1423, in pytest_collection
INTERNALERROR>     return (yield)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 356, in pytest_collection
INTERNALERROR>     session.perform_collect()
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 818, in perform_collect
INTERNALERROR>     self.items.extend(self.genitems(node))
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 986, in genitems
INTERNALERROR>     yield from self.genitems(subnode)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 986, in genitems
INTERNALERROR>     yield from self.genitems(subnode)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 986, in genitems
INTERNALERROR>     yield from self.genitems(subnode)
INTERNALERROR>   [Previous line repeated 1 more time]
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 981, in genitems
INTERNALERROR>     rep, duplicate = self._collect_one_node(node, handle_dupes)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/main.py", line 844, in _collect_one_node
INTERNALERROR>     rep = collect_one_node(node)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/runner.py", line 567, in collect_one_node
INTERNALERROR>     rep: CollectReport = ihook.pytest_make_collect_report(collector=collector)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_hooks.py", line 513, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_manager.py", line 120, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 122, in _multicall
INTERNALERROR>     teardown.throw(exception)  # type: ignore[union-attr]
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/capture.py", line 858, in pytest_make_collect_report
INTERNALERROR>     rep = yield
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/pluggy/_callers.py", line 103, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/runner.py", line 391, in pytest_make_collect_report
INTERNALERROR>     call = CallInfo.from_call(
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/runner.py", line 341, in from_call
INTERNALERROR>     result: Optional[TResult] = func()
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/runner.py", line 389, in collect
INTERNALERROR>     return list(collector.collect())
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/python.py", line 548, in collect
INTERNALERROR>     self._register_setup_module_fixture()
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/python.py", line 561, in _register_setup_module_fixture
INTERNALERROR>     self.obj, ("setUpModule", "setup_module")
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/python.py", line 287, in obj
INTERNALERROR>     self._obj = obj = self._getobj()
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/python.py", line 545, in _getobj
INTERNALERROR>     return importtestmodule(self.path, self.config)
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/python.py", line 492, in importtestmodule
INTERNALERROR>     mod = import_path(
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/pathlib.py", line 591, in import_path
INTERNALERROR>     importlib.import_module(module_name)
INTERNALERROR>   File "/usr/lib64/python3.10/importlib/__init__.py", line 126, in import_module
INTERNALERROR>     return _bootstrap._gcd_import(name[level:], package, level)
INTERNALERROR>   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
INTERNALERROR>   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
INTERNALERROR>   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
INTERNALERROR>   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
INTERNALERROR>   File "/usr/lib/python3.10/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
INTERNALERROR>     exec(co, module.__dict__)
INTERNALERROR>   File "/home/tkloczko/rpmbuild/BUILD/teamcity-messages-1.32/tests/guinea-pigs/unittest/test_changes_name.py", line 19, in <module>
INTERNALERROR>     unittest.main(testRunner=TeamcityTestRunner())
INTERNALERROR>   File "/usr/lib64/python3.10/unittest/main.py", line 100, in __init__
INTERNALERROR>     self.parseArgs(argv)
INTERNALERROR>   File "/usr/lib64/python3.10/unittest/main.py", line 133, in parseArgs
INTERNALERROR>     self._main_parser.parse_args(argv[1:], self)
INTERNALERROR>   File "/usr/lib64/python3.10/argparse.py", line 1836, in parse_args
INTERNALERROR>     self.error(msg % ' '.join(argv))
INTERNALERROR>   File "/usr/lib64/python3.10/argparse.py", line 2594, in error
INTERNALERROR>     self.exit(2, _('%(prog)s: error: %(message)s\n') % args)
INTERNALERROR>   File "/usr/lib64/python3.10/argparse.py", line 2581, in exit
INTERNALERROR>     _sys.exit(status)
INTERNALERROR> SystemExit: 2
mainloop: caught unexpected SystemExit!

========================================================================= 1 skipped, 3 warnings, 8 errors in 0.15s ==========================================================================

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

1 participant