Tox: deps passed to pip are not de-factorized

Created on 9 Dec 2017  路  11Comments  路  Source: tox-dev/tox

Given this tox.ini:

[testenv]
deps =
  foo
  coverage: coverage

[testenv:sub]
deps =
  {[testenv]deps}

Running tox -e sub results in:

sub create: /tmp/t1/.tox/sub
sub installdeps: foo, coverage: coverage
ERROR: invocation failed (exit code 1), logfile: /tmp/t1/.tox/sub/log/sub-1.log
ERROR: actionid: sub
msg: getenv
cmdargs: ['/tmp/t1/.tox/sub/bin/pip', 'install', 'foo', 'coverage: coverage']

Invalid requirement: 'coverage: coverage'
Traceback (most recent call last):
  File "/tmp/tox/tmp/t1/sub/lib/python3.6/site-packages/pip/_vendor/packaging/requirements.py", line 92, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/tmp/tox/tmp/t1/sub/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1617, in parseString
    raise exc
  File "/tmp/tox/tmp/t1/sub/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1607, in parseString
    loc, tokens = self._parse( instring, 0 )
  File "/tmp/tox/tmp/t1/sub/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1379, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/tmp/tox/tmp/t1/sub/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 3376, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/tmp/tox/tmp/t1/sub/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1383, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/tmp/tox/tmp/t1/sub/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 3164, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pip._vendor.pyparsing.ParseException: Expected stringEnd (at char 8), (line:1, col:9)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tmp/tox/tmp/t1/sub/lib/python3.6/site-packages/pip/req/req_install.py", line 82, in __init__
    req = Requirement(req)
  File "/tmp/tox/tmp/t1/sub/lib/python3.6/site-packages/pip/_vendor/packaging/requirements.py", line 96, in __init__
    requirement_string[e.loc:e.loc + 8]))
pip._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "': covera'"


ERROR: could not install deps [foo, coverage: coverage]; v = InvocationError('/tmp/t1/.tox/sub/bin/pip install foo coverage: coverage (see /tmp/t1/.tox/sub/log/sub-1.log)', 1)
__________________________________________ summary __________________________________________
ERROR:   sub: could not install deps [foo, coverage: coverage]; v = InvocationError('/tmp/t1/.tox/sub/bin/pip install foo coverage: coverage (see /tmp/t1/.tox/sub/log/sub-1.log)', 1)

tox 2.9.2.dev35 (current master).

  1. it should only install 'coverage' and not 'coverage: coverage'
  2. it should only install it for when the "coverage" factor is used.
normal

Most helpful comment

Hello, I've had some free time and I've prepared a PR. Hope it helps.

All 11 comments

I agree this should be implemented. @gaborbernat did this used to work? otherwise I think it's more of a feature request than a "critical bug" :)

Hello, I've had some free time and I've prepared a PR. Hope it helps.

Sorry, we had a regression in 3.1 with the fix, so I reverted it.

On the plus side, there is an xfailing reproducer for this bug now. Another attempt of fixing this would need to take into account configurations like encountered in https://github.com/tox-dev/tox/issues/899 and https://github.com/tox-dev/tox/issues/906.

Reopening this then.

Thanks for handling this, @obestwalter !

Link to the revert for reference: https://github.com/tox-dev/tox/commit/b1e526db570bdb28f4d9a6d51ef1a77fe84b8c43

Hopefully @bartsanchez finds some time again to give it a second shot.. :)

Ran into this trying to install an env without a factor, and having it fail. This seems pretty bad to me, but I guess I can just "factor" my lint & docs envs for now.

@ericholscher can you post your example problem, just to illustrate the issue.

This file was the issue: https://github.com/rtfd/recommonmark/blob/0440308592db91b8f4cf8d8f7f3d2273498cc19e/tox.ini

Then:

-> tox -e lint
GLOB sdist-make: /Users/eric/projects/recommonmark/setup.py
lint create: /Users/eric/projects/recommonmark/.tox/lint
lint installdeps: ., pytest, sphinx16: Sphinx < 1.7, sphinx17: Sphinx < 1.8, sphinx18: Sphinx < 1.9, prospector
GitHub
A markdown parser for docutils. Contribute to rtfd/recommonmark development by creating an account on GitHub.

I fixed it by adding a factor to the tasks:

  • lint-sphinx16
  • docs-sphinx16

Which isn't such a big deal, but a little confusing trying to figure out what's going on.

I think I've fixed it by "applying_factors" --> "replacing" --> "applying_factors" (again) in order to get both functionalities working together in:

https://github.com/tox-dev/tox/pull/1058

Fixed via #1058

Thanks!

Was this page helpful?
0 / 5 - 0 ratings