mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix for issue #8519
Also added a test that fails prior to the fix, illustrating the problem.
This commit is contained in:
parent
4292ad334e
commit
f487d5568a
2 changed files with 17 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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'})
|
||||
|
|
Loading…
Add table
Reference in a new issue