warn if a command does not come from the venv

Issue #2 on hold
Holger Krekel repo owner created an issue

If one forgets to specify a dep like "pytest" then the invoking shell's py.test is used and thus the wrong version/wrong interpreter is used.

Comments (13)

  1. Holger Krekel reporter

    fix issue 2 - warn if a test command does not come from the test environment. also refine when the configuration of a virtualenv is written so that a subsequent run can compare to it

    bc1a8b5ecd94

  2. Marc Schlaich
    • changed status to new

    There is a problem with sitepackages=True, in this case the test dependency does not get installed in the test environment if it is already installed.

    Any idea how to solve this?

  3. Holger Krekel reporter

    Can you provide a more complete description of the situation including the tox screenlog?

  4. Marc Schlaich

    I am testing py25 and py27 with the sitepackages=True option and with dependency *nosetests*. Nosetest is already installed in both environments. py27 is in my PATH. py25 is running with the wrong nosetests version:

    [TOX] WARNING:test command found but not installed in testenv
      cmd: C:\Python27\Scripts\nosetests.EXE
      env: D:\testlib\.tox\py25
    Maybe forgot to specify a dependency?
    
  5. Holger Krekel reporter

    Why do you think it's the wrong nosetests version?

    The warning seems like correct behaviour because even with despite sitepackages=True tox assumes you only run commands that were installed to the virtualenv. If you want to maintain your setting and want to get rid of the warning tox would need something like a "command_whitelist" configuration which lists commands that should not be considered for warnings. If you want this, please open another issue. I am re-resolving this issue.

  6. Armin Ronacher

    This is very annoying if you want to use makefiles. Can we have a way to disable this warning?

  7. Marc Schlaich

    @hpk42 You didn't get the point. The problem is that the py25 environment runs the 2.7 "nosetests" command (because C:\Python27\Scripts is in my PATH) but it should use the 2.5 version. But the 2.5 version doesn't get installed in the tox environment because it is already installed in 2.5 site-packages.

  8. Holger Krekel reporter

    @mitsuhiko i added a whitelist_externals=MULTI_LINE_LIST config variable for testenvs. Just put whitelist_externals=make to not get warnings anymore. or =* to ignore all missing commands. You can install the according tox version via: pip install -i http://pypi.testrun.org -U tox. Let me know if that is enough for your purposes or if you suggest a different config variable name.

    @schlamar the wrongly picked up is a different issue. Will see to fix it separately and report back here.

  9. Marc Schlaich

    @hpk42 Well, the issue is that "nose" doesn't get installed in the first place because it is already in site-packages. And the test run picks the nose version from the PATH which is the wrong Python version. A solution would be to add the "bin" directory of the current interpreter to the PATH after the "bin" of the venv. Not sure if this a sane solution though...

  10. Log in to comment