summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2015-11-02 12:59:42 +0100
committerholger krekel <holger@merlinux.eu>2015-11-02 12:59:42 +0100
commitc4c086a1747c0340f64dbb95bd58936f0e6c0676 (patch)
tree84ec0adc5e5b375a6c041b191a27da97cb76c8e2
parente3f83b9791ed9217b17c8be647027fbd02d34af1 (diff)
downloadtox-c4c086a1747c0340f64dbb95bd58936f0e6c0676.tar.gz
fix issue281: make --force-deps work when urls are present in a dep config
-rw-r--r--CHANGELOG3
-rw-r--r--tests/test_config.py20
-rw-r--r--tox/config.py6
3 files changed, 28 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 2bd2f6d..3cb3116 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -11,6 +11,9 @@
- fix issue99: the {env:...} substitution now properly uses environment
settings from the ``setenv`` section. Thanks Itxaka Serrano.
+- fix issue281: make --force-deps work when urls are present in
+ dependency configs. Thanks Glyph Lefkowitz for reporting.
+
2.1.1
----------
diff --git a/tests/test_config.py b/tests/test_config.py
index af77b49..93cd8bf 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -88,6 +88,26 @@ class TestVenvConfig:
'dep1==1.5', 'dep2==2.1', 'dep3==3.0', 'dep4==4.0',
]
+ def test_force_dep_with_url(self, initproj):
+ initproj("example123-0.5", filedefs={
+ 'tox.ini': '''
+ [tox]
+
+ [testenv]
+ deps=
+ dep1==1.0
+ https://pypi.python.org/xyz/pkg1.tar.gz
+ '''
+ })
+ config = parseconfig(
+ ['--force-dep=dep1==1.5'])
+ assert config.option.force_dep == [
+ 'dep1==1.5'
+ ]
+ assert [str(x) for x in config.envconfigs['python'].deps] == [
+ 'dep1==1.5', 'https://pypi.python.org/xyz/pkg1.tar.gz'
+ ]
+
def test_is_same_dep(self):
"""
Ensure correct parseini._is_same_dep is working with a few samples.
diff --git a/tox/config.py b/tox/config.py
index 1c16c36..3f4c8af 100644
--- a/tox/config.py
+++ b/tox/config.py
@@ -141,7 +141,11 @@ class DepOption:
same package, even if versions differ.
"""
dep1_name = pkg_resources.Requirement.parse(dep1).project_name
- dep2_name = pkg_resources.Requirement.parse(dep2).project_name
+ try:
+ dep2_name = pkg_resources.Requirement.parse(dep2).project_name
+ except pkg_resources.RequirementParseError:
+ # we couldn't parse a version, probably a URL
+ return False
return dep1_name == dep2_name