Fix for issue #8519

Also added a test that fails prior to the fix, illustrating the problem.
This commit is contained in:
Emil Stenqvist 2013-11-14 14:23:09 +01:00
parent 4292ad334e
commit f487d5568a
2 changed files with 17 additions and 2 deletions

View file

@ -118,7 +118,8 @@ def installed(name,
name
The name of the python package to install. You can also specify version
numbers here using the standard operators ``==, >=, <=``.
numbers here using the standard operators ``==, >=, <=``. If
``requiremenets`` is given, this parameter will be ignored.
Example::
@ -223,7 +224,7 @@ def installed(name,
from_vcs = False
if name:
if name and not requirements:
try:
try:
# With pip < 1.2, the __version__ attribute does not exist and

View file

@ -279,6 +279,20 @@ class PipStateTest(TestCase, integration.SaltReturnAssertsMixIn):
{'test': ret}
)
mock = MagicMock(return_value={'retcode': 0, 'stdout': ''})
pip_list = MagicMock(return_value={'pep8': '1.3.1'})
pip_install = MagicMock(return_value={ 'retcode': 0 })
with patch.dict(pip_state.__salt__, {'cmd.run_all': mock,
'pip.list': pip_list,
'pip.install': pip_install}):
with patch.dict(pip_state.__opts__, {'test': False}):
ret = pip_state.installed(
'arbitrary ID that should be ignored due to requirements specified',
requirements='/tmp/non-existing-requirements.txt'
)
self.assertSaltTrueReturn({'test': ret})
# Test VCS installations using git+git://
mock = MagicMock(return_value={'retcode': 0, 'stdout': ''})
pip_list = MagicMock(return_value={'pep8': '1.3.1'})