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

Unable to exec py27 tox suite on macOS/Homebrew #1683

Closed
jd opened this issue Mar 2, 2020 · 3 comments · Fixed by #1706
Closed

Unable to exec py27 tox suite on macOS/Homebrew #1683

jd opened this issue Mar 2, 2020 · 3 comments · Fixed by #1706
Assignees
Labels

Comments

@jd
Copy link
Contributor

jd commented Mar 2, 2020

$ tox -e py27 -- -k test_creator
[...]

====================================================================================== ERRORS =======================================================================================
____________________________________________________ ERROR collecting tests/unit/discovery/py_info/test_py_info_exe_based_of.py _____________________________________________________
tests/unit/discovery/py_info/test_py_info_exe_based_of.py:20: in <module>
    BASE = {str(Path(CURRENT.executable).parent.relative_to(Path(CURRENT.prefix))), "."}
/usr/local/lib/python2.7/site-packages/pathlib2/__init__.py:1132: in relative_to
    .format(str(self), str(formatted)))
E   ValueError: '/usr/local/opt/python@2/bin' does not start with '/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7'
-------------------------------------------------------- generated xml file: /Users/jd/Source/virtualenv/.tox/junit.py27.xml --------------------------------------------------------
============================================================================== short test summary info ==============================================================================
FAILED tests/unit/discovery/py_info/test_py_info_exe_based_of.py - ValueError: '/usr/local/opt/python@2/bin' does not start with '/usr/local/Cellar/python@2/2.7.17_1/Frameworks/P...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================================================== 134 deselected, 1 error in 0.45 seconds ======================================================================
Coverage.py warning: Module /Users/jd/Source/virtualenv/.tox/py27/lib/python2.7/site-packages/virtualenv was never imported. (module-not-imported)
Coverage.py warning: No data was collected. (no-data-collected)
ERROR: InvocationError for command /Users/jd/Source/virtualenv/.tox/py27/bin/python -m coverage run -m pytest --junitxml .tox/junit.py27.xml tests -k test_creator (exited with code 2)
______________________________________________________________________________________ summary ______________________________________________________________________________________
ERROR:   py27: commands failed

I think the problem is that the path is a symlink:

$ ls -dl /usr/local/opt/python@2
lrwxr-xr-x  1 jd  admin  27 Dec 29 19:09 /usr/local/opt/python@2 -> ../Cellar/python@2/2.7.17_1
@jd jd added the bug label Mar 2, 2020
@jd jd changed the title Unable to read py27 tox suite with Python 2.7 on macOS/Homebrew Unable to exec py27 tox suite on macOS/Homebrew Mar 2, 2020
@gaborbernat
Copy link
Contributor

gaborbernat commented Mar 2, 2020

For now just do:

BASE = {str(Path(CURRENT.executable).resolve().parent.relative_to(Path(CURRENT.prefix))), "."}

@jd
Copy link
Contributor Author

jd commented Mar 2, 2020

For now just do:

BASE = {str(Path(CURRENT.executable).resolve().parent.relative_to(Path(CURRENT.prefix))), "."}

That does solve the problem, thank you!

@jd
Copy link
Contributor Author

jd commented Mar 2, 2020

However, I realized it breaks for Python 3.7:

E   ValueError: '/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin' does not start with '/Users/jd/Source/virtualenv/.tox/py37'

@gaborbernat gaborbernat self-assigned this Mar 9, 2020
gaborbernat added a commit that referenced this issue Mar 10, 2020
Resolves #1683.

Signed-off-by: Bernat Gabor <bgabor8@bloomberg.net>
@pypa pypa locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants