1 new commit in tox:
https://bitbucket.org/hpk42/tox/commits/1c6afe4646fc/
Changeset: 1c6afe4646fc
User: hpk42
Date: 2015-03-09 07:10:45+00:00
Summary: Merged in sontek/tox/fix-force-dep-with-reqs-file-with-pip (pull
request #136)
Support force dependencies with requirements.txt using pip
Affected #: 2 files
diff -r 69f9be62ef38ef3dca9a932d79f2df85c834258a -r
1c6afe4646fcd4ccc8a6e4c20cc8bc19d6a4549b tests/test_config.py
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -1423,6 +1423,50 @@
r'*deps=*dep1, dep2==5.0*',
])
+ def test_force_dep_with_requirements_txt_file(self, cmd, initproj):
+ """
+ Make sure we can override dependencies configured in external reqs.txt
+ when using the command line option --force-dep.
+ """
+ initproj("example123-0.5", filedefs={
+ 'tox.ini': '''
+ [tox]
+
+ [testenv]
+ deps=
+ dep1==1.0
+ -r{toxinidir}/reqs.txt
+ ''',
+ 'reqs.txt': '''
+ -e git://hello/world/git#egg=Hello
+ # comment
+ dep2>=2.0 # comment
+
+
+ -i http://index.local/
+ dep3
+ dep4==4.0
+ -r reqs2.txt
+ ''',
+ 'reqs2.txt': '''
+ dep5>=2.2
+ '''
+ })
+ config = parseconfig(
+ ['--force-dep=dep1==1.5', '--force-dep=dep2==2.1',
+ '--force-dep=dep3==3.0'])
+ assert config.option.force_dep == [
+ 'dep1==1.5', 'dep2==2.1', 'dep3==3.0']
+
+ deps = config.envconfigs['python'].deps
+ assert len(deps) == 6
+ expected = ['dep1==1.5', 'Hello', 'dep2==2.1',
+ 'dep3==3.0', 'dep4', 'dep5']
+
+ for index, dep in enumerate(deps):
+ assert dep.name == expected[index]
+
+
class TestArgumentParser:
def test_dash_e_single_1(self):
diff -r 69f9be62ef38ef3dca9a932d79f2df85c834258a -r
1c6afe4646fcd4ccc8a6e4c20cc8bc19d6a4549b tox/_config.py
--- a/tox/_config.py
+++ b/tox/_config.py
@@ -9,7 +9,8 @@
import itertools
from tox.interpreters import Interpreters
-
+from pip.req.req_file import parse_requirements
+from pip.download import PipSession
import py
import tox
@@ -371,6 +372,8 @@
vc.whitelist_externals = reader.getlist(section,
"whitelist_externals")
vc.deps = []
+ requirement_files = []
+
for depline in reader.getlist(section, "deps"):
m = re.match(r":(\w+):\s*(\S+)", depline)
if m:
@@ -379,8 +382,29 @@
else:
name = depline.strip()
ixserver = None
- name = self._replace_forced_dep(name, config)
- vc.deps.append(DepConfig(name, ixserver))
+
+
+ # We want to parse requirements.txt files last so that
+ # we can process them with forced dependencies
+ if name[:2] == '-r':
+ fname = name[2:].strip()
+ requirement_files.append(fname)
+ else:
+ name = self._replace_forced_dep(name, config)
+ vc.deps.append(DepConfig(name, ixserver))
+
+ pip_session = PipSession()
+
+ for requirement_file in requirement_files:
+ req_deps = parse_requirements(
+ requirement_file,
+ session=pip_session
+ )
+
+ for r in req_deps:
+ name = self._replace_forced_dep(r.name, config)
+ vc.deps.append(DepConfig(name, ixserver))
+
vc.distribute = reader.getbool(section, "distribute", False)
vc.sitepackages = self.config.option.sitepackages or \
reader.getbool(section, "sitepackages", False)
Repository URL: https://bitbucket.org/hpk42/tox/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
pytest-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pytest-commit