Dropping the version check for InstallationError down to anything 1.0 or greater. Removing the test that simulates versions of pip below 1.0.

This commit is contained in:
Gareth J. Greenaway 2019-05-04 12:55:36 -07:00 committed by Ch3LL
parent 4ec90c2d39
commit 78aeb61f67
No known key found for this signature in database
GPG key ID: 132B55A7C13EFA73
2 changed files with 2 additions and 25 deletions

View file

@ -67,8 +67,8 @@ if HAS_PIP is True:
from pip._internal.exceptions import InstallationError # pylint: disable=E0611,E0401
elif salt.utils.versions.compare(ver1=pip.__version__,
oper='>=',
ver2='10.0'):
from pip.exceptions import InstallationError # pylint: disable=E0611,E0401
ver2='1.0'):
from pip.exceptions import InstallationError # pylint: disable=E0610,E0401
else:
InstallationError = ValueError

View file

@ -256,29 +256,6 @@ class PipStateTest(TestCase, SaltReturnAssertsMixin, LoaderModuleMockMixin):
{'test': ret}
)
# Test VCS installations with version info like >= 0.1
with patch.object(pip, '__version__', MagicMock(side_effect=AttributeError(
'Faked missing __version__ attribute'))):
mock = MagicMock(return_value={'retcode': 0, 'stdout': ''})
pip_list = MagicMock(return_value={'SaltTesting': '0.5.0'})
pip_install = MagicMock(return_value={
'retcode': 0,
'stderr': '',
'stdout': 'Cloned!'
})
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(
'git+https://github.com/saltstack/salt-testing.git#egg=SaltTesting>=0.5.0'
)
self.assertSaltTrueReturn({'test': ret})
self.assertInSaltComment(
'packages are already installed',
{'test': ret}
)
def test_install_in_editable_mode(self):
'''
Check that `name` parameter containing bad characters is not parsed by