[Pytest-commit] commit/tox: hpk42: merged and slightly modified PR81: new option --force-dep which allows to
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Nov 22 07:52:05 CET 2013
1 new commit in tox:
https://bitbucket.org/hpk42/tox/commits/7d8976da0b00/
Changeset: 7d8976da0b00
User: hpk42
Date: 2013-11-22 07:51:21
Summary: merged and slightly modified PR81: new option --force-dep which allows to
override tox.ini specified dependencies in setuptools-style.
For example "--force-dep 'django<1.6'" will make sure
that any environment using "django" as a dependency will
get the latest 1.5 release. Thanks Bruno Oliveria for
the complete PR.
Affected #: 3 files
diff -r 93a867482895e5ba5ad879e8a68211a9f2ebefc9 -r 7d8976da0b000e0d36ef61545c0f779bb9fe4c09 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,13 @@
1.6.2.dev
---------
+- merged PR81: new option --force-dep which allows to
+ override tox.ini specified dependencies in setuptools-style.
+ For example "--force-dep 'django<1.6'" will make sure
+ that any environment using "django" as a dependency will
+ get the latest 1.5 release. Thanks Bruno Oliveria for
+ the complete PR.
+
- merged PR125: tox now sets "PYTHONHASHSEED" to a random value
and offers a "--hashseed" option to repeat a test run with a specific seed.
You can also use --hashsheed=notset to instruct tox to leave the value
@@ -21,8 +28,8 @@
- fix issue129: tox now uses Popen(..., universal_newlines=True) to force
creation of unicode stdout/stderr streams. fixes a problem on specific
- platform configs when creating virtualenvs with Python3.3. Thanks Jorgen Schäfer
- or investigation and solution sketch.
+ platform configs when creating virtualenvs with Python3.3. Thanks
+ Jorgen Schäfer or investigation and solution sketch.
- fix issue128: enable full substitution in install_command,
thanks for the PR to Ronald Evers
diff -r 93a867482895e5ba5ad879e8a68211a9f2ebefc9 -r 7d8976da0b000e0d36ef61545c0f779bb9fe4c09 tests/test_config.py
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -65,7 +65,7 @@
def test_force_dep_version(self, initproj):
"""
Make sure we can override dependencies configured in tox.ini when using the command line option
- --force-dep-version.
+ --force-dep.
"""
initproj("example123-0.5", filedefs={
'tox.ini': '''
@@ -80,8 +80,10 @@
'''
})
config = parseconfig(
- ['--force-dep-version=dep1==1.5', '--force-dep-version=dep2==2.1', '--force-dep-version=dep3==3.0'])
- assert config.option.force_dep_version == ['dep1==1.5', 'dep2==2.1', 'dep3==3.0']
+ ['--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']
assert [str(x) for x in config.envconfigs['python'].deps] == [
'dep1==1.5', 'dep2==2.1', 'dep3==3.0', 'dep4==4.0',
]
@@ -1194,7 +1196,8 @@
r'*deps=*dep1==2.3, dep2*',
])
# override dep1 specific version, and force version for dep2
- result = cmd.run("tox", "--showconfig", "--force-dep-version=dep1", "--force-dep-version=dep2==5.0")
+ result = cmd.run("tox", "--showconfig", "--force-dep=dep1",
+ "--force-dep=dep2==5.0")
assert result.ret == 0
result.stdout.fnmatch_lines([
r'*deps=*dep1, dep2==5.0*',
diff -r 93a867482895e5ba5ad879e8a68211a9f2ebefc9 -r 7d8976da0b000e0d36ef61545c0f779bb9fe4c09 tox/_config.py
--- a/tox/_config.py
+++ b/tox/_config.py
@@ -125,10 +125,11 @@
help="set PYTHONHASHSEED to SEED before running commands. "
"Defaults to a random integer in the range 1 to 4294967295. "
"Passing 'noset' suppresses this behavior.")
- parser.add_argument("--force-dep-version", action="append",
- metavar="DEP==VER", default=None,
+ parser.add_argument("--force-dep", action="append",
+ metavar="REQ", default=None,
help="Forces a certain version of one of the dependencies "
- "when configuring the virtual environment.")
+ "when configuring the virtual environment. REQ Examples "
+ "'pytest<2.4' or 'django>=1.6'.")
parser.add_argument("args", nargs="*",
help="additional arguments available to command positional substitution")
return parser
@@ -400,9 +401,9 @@
:param config: Config instance
:return: the new dependency that should be used for virtual environments
"""
- if not config.option.force_dep_version:
+ if not config.option.force_dep:
return name
- for forced_dep in config.option.force_dep_version:
+ for forced_dep in config.option.force_dep:
if self._is_same_dep(forced_dep, name):
return forced_dep
return name
@@ -410,7 +411,8 @@
@classmethod
def _is_same_dep(cls, dep1, dep2):
"""
- Returns True if both dependency definitions refer to the same package, even if versions differ.
+ Returns True if both dependency definitions refer to the
+ same package, even if versions differ.
"""
dep1_name = pkg_resources.Requirement.parse(dep1).project_name
dep2_name = pkg_resources.Requirement.parse(dep2).project_name
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.
More information about the pytest-commit
mailing list