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

Vendoring of py.py causes tox to break #10505

Closed
hloeung opened this issue Nov 17, 2022 · 1 comment
Closed

Vendoring of py.py causes tox to break #10505

hloeung opened this issue Nov 17, 2022 · 1 comment

Comments

@hloeung
Copy link

hloeung commented Nov 17, 2022

Hi,

In 19dda7c, pytest now includes py.py. This causes tox to break as follows:

$ tox -e unittest
Traceback (most recent call last):
  File "/usr/bin/tox", line 33, in <module>
    sys.exit(load_entry_point('tox==3.21.4', 'console_scripts', 'tox')())
  File "/usr/bin/tox", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/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 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/tox/__init__.py", line 32, in <module>
    from .session import cmdline  # isort:skip
  File "/usr/lib/python3/dist-packages/tox/session/__init__.py", line 20, in <module>
    from tox import reporter
  File "/usr/lib/python3/dist-packages/tox/reporter.py", line 127, in <module>
    _INSTANCE = Reporter()
  File "/usr/lib/python3/dist-packages/tox/reporter.py", line 32, in __init__
    self._reset(**kwargs)
  File "/usr/lib/python3/dist-packages/tox/reporter.py", line 38, in _reset
    self.tw = py.io.TerminalWriter()
AttributeError: module 'py' has no attribute 'io'

Removing ~/.local/lib/python3.10/site-packages/py.py allows it to run successfully.

My steps to reproduce this is to have requirements.txt as follows:

pycountry-convert

Then:

pip install -r requirements.txt

Now check out ~/.local/lib/python3.10/site-packages/ which now has py.py. Then try run tox -e ....

This is with an Ubuntu Jammy/22.04 VM.

@Zac-HD
Copy link
Member

Zac-HD commented Nov 19, 2022

See #10420 (comment)

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