python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.54k stars 2.27k forks source link

Shipped/default version of pytest (`poetry new`) breaking dependencies #5482

Closed schlich closed 2 years ago

schlich commented 2 years ago

Issue

default pytest version shipped with poetry new breaks dependencies.

Related to this SO thread.

error traceback:

Traceback (most recent call last):
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/bin/pytest", line 8, in <module>
    sys.exit(main())
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/_pytest/config/__init__.py", line 105, in main
    config = _prepareconfig(args, plugins)
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/_pytest/config/__init__.py", line 257, in _prepareconfig
    return pluginmanager.hook.pytest_cmdline_parse(
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/pluggy/hooks.py", line 286, in __call__
    return self._hookexec(self, self.get_hookimpls(), kwargs)
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/pluggy/manager.py", line 93, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/pluggy/manager.py", line 84, in <lambda>
    self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/pluggy/callers.py", line 203, in _multicall
    gen.send(outcome)
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/_pytest/helpconfig.py", line 90, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/pluggy/callers.py", line 80, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/pluggy/callers.py", line 187, in _multicall
    res = hook_impl.function(*args)
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/_pytest/config/__init__.py", line 836, in pytest_cmdline_parse
    self.parse(args)
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/_pytest/config/__init__.py", line 1044, in parse
    self._preparse(args, addopts=addopts)
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/_pytest/config/__init__.py", line 992, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/pluggy/manager.py", line 299, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/home/tyler/.pyenv/versions/3.10.4/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/home/tyler/.pyenv/versions/3.10.4/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/_pytest/assertion/rewrite.py", line 152, in exec_module
    exec(co, module.__dict__)
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/datatest/__init__.py", line 12, in <module>
    from .validation import *   # Validation error and functions.
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/_pytest/assertion/rewrite.py", line 143, in exec_module
    source_stat, co = _rewrite_test(fn, self.config)
  File "/home/tyler/.cache/pypoetry/virtualenvs/test-HlZPn_wB-py3.10/lib/python3.10/site-packages/_pytest/assertion/rewrite.py", line 330, in _rewrite_test
    co = compile(tree, fn, "exec", dont_inherit=True)
TypeError: required field "lineno" missing from alias

May be helpful to upgrade the shipped version of pytest to at least 6.2.5 as per the SO thread.

dimbleby commented 2 years ago

master doesn't add pytest at all, since f5a63be614e2c4d94d49b56d39b8bfeabc61ff66

github-actions[bot] commented 7 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.