man-group / pytest-plugins

A grab-bag of nifty pytest plugins
MIT License
568 stars 85 forks source link

Invalid command '.' with virtualenv.install_package(installer='pip') #163

Open jaraco opened 4 years ago

jaraco commented 4 years ago

The readme indicates to use virtualenv.install_package('coverage', installer='pip'), but if I use that command as virtualenv.install_package('.', installer='pip'), it fails with Invalid command '.' and the command it's trying to run is pip -q . (no install command). That's unexpected. I would have expected installer='pip' to invoke pip install.

smheidrich commented 3 years ago

I had the same issue. Also, pytest-virtualenv using easy_install by default might not be such a good idea, considering it's deprecated in favor of pip.

For anyone else who has this issue, a workaround is to use the pytest-venv plugin instead, which uses pip and also does some other things better (IMHO), e.g. it uses pytest's own tmpdir fixture so the venv temp dir will always be under pytest's base temp dir and have pytest's tmpdir features like preserving the last N temp dirs, whereas pytest-virtualenv uses a homegrown temp dir in os.getenv("WORKSPACE") / /tmp.