tox-dev/tox-pipenv

Tox envbindir mismatch using the tox-pipenv plugin

ivar-lazzaro opened this issue · 1 comments

tox version = 3.5.3
tox-pipenv version = 1.8.0

Running tox using tox-pipenv produces the following output:

WARNING: test command found but not installed in testenv
cmd: /Users/myself/workspace/project/venv/bin/python
env: /Users/myself/workspace/project/.tox/py36
Maybe you forgot to specify a dependency? See also the whitelist_externals envconfig setting.

Tests pass correctly, but the above warning indicates that my venv's python binary was used instead of that installed in the tox envbindir.
Digging a bit into tox code, I found the following in config.py:

def get_envbindir(self):
    """Path to directory where scripts/binaries reside."""
    if tox.INFO.IS_WIN and "jython" not in self.basepython and "pypy" not in self.basepython:
        return self.envdir.join("Scripts")
    else:
        return self.envdir.join("bin")

where envdir points to "/Users/myself/workspace/project/.tox/py36", whereas tox-pipenv creates the virtual environment in /Users/myself/workspace/project/.tox/py36/.venv

If I try to override envdir in my tox.ini to point to .tox/py36/.venv, then tox creates .tox/py36/.venv/.venv :)

Adding "python" to whitelist_externals suppresses the warning, but I wonder if envdir shouldn't point to the actual environment directory instead.

hi @ivar-lazzaro this is a known (yet undocumented) issue.

I haven't found a reliable way around this, without potentially adding a compromising whitelist to the default settings.

My understanding is that pipenv doesn't copy the python binary in the same way that venv would, so the binary it's calling is elsewhere