Closed stanislavlevin closed 5 years ago
The deps
setting specifies that coverage
is installed in this virtual environment, so that should be the coverage command that tox runs. If you try to run a command that's found outside the virtual environment, tox will issue a warning. Are you seeing that warning?
$ cat tox.ini
[tox]
skipsdist = true
[testenv]
commands = coverage
skip_install = true
$ tox
python create: /private/tmp/.tox/python
python installed:
python runtests: PYTHONHASHSEED='3306463346'
python runtests: commands[0] | coverage
WARNING:test command found but not installed in testenv
cmd: /Users/.../bin/coverage
env: /private/tmp/.tox/python
Maybe you forgot to specify a dependency? See also the whitelist_externals envconfig setting.
Yes, while using 'coverage run ...' i have that message.
For me: python3 tests are failed (because in my distro coverage for python2, coverage3 - python3).
If you're seeing that message, then something's not right in your virtualenvironment. Perhaps you're using an old version of tox? If its outdated, try updating it. Also try deleting your .tox directory and starting over.
Notice how if I add coverage
to the deps list, I no longer get the warning:
$ cat tox.ini
[tox]
skipsdist = true
[testenv]
commands = coverage
skip_install = true
deps = coverage
$ tox
python recreate: /private/tmp/.tox/python
python installdeps: coverage
python installed: coverage==4.5.1
python runtests: PYTHONHASHSEED='2524532263'
python runtests: commands[0] | coverage
Code coverage for Python. Use 'coverage help' for help.
_____________________________________________ summary____________________________________________
python: commands succeeded
congratulations :)
$ tox --version
2.9.1 imported from ...
I'm packing zope.annotation python module in ALTLinux and going to run tests at rpm build time. This means there is no network support and i use sitepackages option either pass PYTHONPATH variable to tox like:
export PIP_INDEX_URL=http://host.invalid.
export PYTHONPATH=/usr/lib/python2.7/site-packages:/usr/lib64/python2.7/site-packages:src
TOX_TESTENV_PASSENV='PYTHONPATH' tox -e py27 -v
As coverage/coverage3 script is at /usr/bin/ directory it is not imported to virtualenv by current settings.
The universal solution is change script execution to module import. What are the disadvantages of this approach?
I do not think tox is a tool suitable for distro packaging. Why not run the test suite directly? Presumably you're already installing the build dependencies from other distro packages.
There's been no further discussion of this in 8 months so I'll go ahead and close it. Feel free to reopen if there is more to do!
Linux distributions provides coverage script on their own way for support python2 and python3 both together. For example coverage with python2 shebang either with python3 one. Or scripts with another names, e.g. coverage - python2 shebang, coverage3 - python3 shebang. Therefore it is better to import module instead.