2012-09-27 11:06:09 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2012-12-11 10:23:37 +00:00
|
|
|
'''
|
|
|
|
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
|
2013-09-16 16:24:00 +00:00
|
|
|
|
|
|
|
tests.integration.modules.pip
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2012-12-11 10:23:37 +00:00
|
|
|
'''
|
2012-09-27 11:06:09 +00:00
|
|
|
|
2012-12-11 10:23:37 +00:00
|
|
|
# Import python libs
|
2014-11-21 19:05:13 +00:00
|
|
|
from __future__ import absolute_import
|
2012-09-27 11:06:09 +00:00
|
|
|
import os
|
2013-05-05 03:09:50 +00:00
|
|
|
import pwd
|
2012-09-27 11:06:09 +00:00
|
|
|
import shutil
|
2015-12-27 03:30:27 +00:00
|
|
|
import re
|
2012-09-27 11:06:09 +00:00
|
|
|
import tempfile
|
|
|
|
|
2013-06-27 11:36:37 +00:00
|
|
|
# Import Salt Testing libs
|
2013-07-04 17:57:42 +00:00
|
|
|
from salttesting import skipIf
|
2013-06-27 11:36:37 +00:00
|
|
|
from salttesting.helpers import ensure_in_syspath
|
|
|
|
ensure_in_syspath('../../')
|
|
|
|
|
2012-09-27 11:06:09 +00:00
|
|
|
# Import salt libs
|
2013-06-27 11:36:37 +00:00
|
|
|
import integration
|
2014-01-02 20:27:18 +00:00
|
|
|
import salt.utils
|
2014-01-11 19:19:29 +00:00
|
|
|
from salt.modules.virtualenv_mod import KNOWN_BINARY_NAMES
|
2012-09-27 11:06:09 +00:00
|
|
|
|
|
|
|
|
2014-01-11 19:19:29 +00:00
|
|
|
@skipIf(salt.utils.which_bin(KNOWN_BINARY_NAMES) is None, 'virtualenv not installed')
|
2012-09-27 11:06:09 +00:00
|
|
|
class PipModuleTest(integration.ModuleCase):
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
super(PipModuleTest, self).setUp()
|
|
|
|
|
2013-08-27 15:31:58 +00:00
|
|
|
self.venv_test_dir = tempfile.mkdtemp(dir=integration.SYS_TMP_DIR)
|
2012-09-27 11:06:09 +00:00
|
|
|
self.venv_dir = os.path.join(self.venv_test_dir, 'venv')
|
2013-07-04 17:57:42 +00:00
|
|
|
for key in os.environ.copy():
|
|
|
|
if key.startswith('PIP_'):
|
|
|
|
os.environ.pop(key)
|
|
|
|
self.pip_temp = os.path.join(self.venv_test_dir, '.pip-temp')
|
|
|
|
if not os.path.isdir(self.pip_temp):
|
|
|
|
os.makedirs(self.pip_temp)
|
|
|
|
os.environ['PIP_SOURCE_DIR'] = os.environ['PIP_BUILD_DIR'] = ''
|
2012-09-27 11:06:09 +00:00
|
|
|
|
2015-12-28 17:19:05 +00:00
|
|
|
def pip_successful_install(self, target, expect=('flake8', 'pep8',)):
|
2015-12-28 18:48:16 +00:00
|
|
|
'''
|
|
|
|
isolate regex for extracting `successful install` message from pip
|
|
|
|
'''
|
2015-12-28 17:19:05 +00:00
|
|
|
|
2015-12-28 18:02:24 +00:00
|
|
|
expect = set(expect)
|
2015-12-28 18:48:16 +00:00
|
|
|
expect_str = '|'.join(expect)
|
2015-12-28 17:19:05 +00:00
|
|
|
|
2015-12-28 18:02:24 +00:00
|
|
|
success = re.search(
|
|
|
|
r'^.*Successfully installed\s([^\n]+)(?:Clean.*)?',
|
|
|
|
target,
|
|
|
|
re.M | re.S)
|
2015-12-28 17:19:05 +00:00
|
|
|
|
2015-12-28 18:02:24 +00:00
|
|
|
success_for = re.findall(
|
2015-12-28 18:48:16 +00:00
|
|
|
r'({0})(?:-(?:[\d\.-]))?'.format(expect_str),
|
2015-12-28 18:02:24 +00:00
|
|
|
success.groups()[0]
|
|
|
|
) if success else []
|
2015-12-28 17:19:05 +00:00
|
|
|
|
2015-12-28 18:02:24 +00:00
|
|
|
return expect.issubset(set(success_for))
|
2015-12-28 17:19:05 +00:00
|
|
|
|
2012-09-27 11:06:09 +00:00
|
|
|
def test_issue_2087_missing_pip(self):
|
|
|
|
# Let's create the testing virtualenv
|
|
|
|
self.run_function('virtualenv.create', [self.venv_dir])
|
|
|
|
|
|
|
|
# Let's remove the pip binary
|
|
|
|
pip_bin = os.path.join(self.venv_dir, 'bin', 'pip')
|
|
|
|
if not os.path.isfile(pip_bin):
|
|
|
|
self.skipTest(
|
|
|
|
'Failed to find the pip binary to the test virtualenv'
|
|
|
|
)
|
|
|
|
os.remove(pip_bin)
|
|
|
|
|
|
|
|
# Let's run a pip depending functions
|
|
|
|
for func in ('pip.freeze', 'pip.list'):
|
|
|
|
ret = self.run_function(func, bin_env=self.venv_dir)
|
2015-05-15 06:00:22 +00:00
|
|
|
self.assertIn(
|
|
|
|
'Command required for \'{0}\' not found: '
|
|
|
|
'Could not find a `pip` binary in virtualenv'.format(func),
|
|
|
|
ret
|
2012-09-27 11:06:09 +00:00
|
|
|
)
|
|
|
|
|
2015-12-28 09:30:19 +00:00
|
|
|
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
|
2015-12-28 17:19:05 +00:00
|
|
|
def test_requirements_as_list_of_chains__sans_no_chown__cwd_set__absolute_file_path(self):
|
2015-12-28 09:30:19 +00:00
|
|
|
self.run_function('virtualenv.create', [self.venv_dir])
|
|
|
|
|
|
|
|
# Create a requirements file that depends on another one.
|
|
|
|
|
|
|
|
req1_filename = os.path.join(self.venv_dir, 'requirements1.txt')
|
|
|
|
req1b_filename = os.path.join(self.venv_dir, 'requirements1b.txt')
|
|
|
|
req2_filename = os.path.join(self.venv_dir, 'requirements2.txt')
|
|
|
|
req2b_filename = os.path.join(self.venv_dir, 'requirements2b.txt')
|
|
|
|
|
|
|
|
with salt.utils.fopen(req1_filename, 'wb') as f:
|
|
|
|
f.write('-r requirements1b.txt\n')
|
|
|
|
with salt.utils.fopen(req1b_filename, 'wb') as f:
|
|
|
|
f.write('flake8\n')
|
|
|
|
with salt.utils.fopen(req2_filename, 'wb') as f:
|
|
|
|
f.write('-r requirements2b.txt\n')
|
|
|
|
with salt.utils.fopen(req2b_filename, 'wb') as f:
|
|
|
|
f.write('pep8\n')
|
|
|
|
|
|
|
|
this_user = pwd.getpwuid(os.getuid())[0]
|
|
|
|
requirements_list = [req1_filename, req2_filename]
|
|
|
|
|
|
|
|
ret = self.run_function(
|
|
|
|
'pip.install', requirements=requirements_list, user=this_user,
|
|
|
|
bin_env=self.venv_dir, cwd=self.venv_dir
|
|
|
|
)
|
|
|
|
try:
|
|
|
|
self.assertEqual(ret['retcode'], 0)
|
|
|
|
|
2015-12-28 17:19:05 +00:00
|
|
|
found = self.pip_successful_install(ret['stdout'])
|
2015-12-28 09:30:19 +00:00
|
|
|
|
|
|
|
self.assertTrue(found)
|
|
|
|
except (AssertionError, TypeError):
|
|
|
|
import pprint
|
|
|
|
pprint.pprint(ret)
|
|
|
|
raise
|
|
|
|
|
|
|
|
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
|
2015-12-28 17:19:05 +00:00
|
|
|
def test_requirements_as_list_of_chains__sans_no_chown__cwd_not_set__absolute_file_path(self):
|
2015-12-28 09:30:19 +00:00
|
|
|
self.run_function('virtualenv.create', [self.venv_dir])
|
|
|
|
|
|
|
|
# Create a requirements file that depends on another one.
|
|
|
|
|
|
|
|
req1_filename = os.path.join(self.venv_dir, 'requirements1.txt')
|
|
|
|
req1b_filename = os.path.join(self.venv_dir, 'requirements1b.txt')
|
|
|
|
req2_filename = os.path.join(self.venv_dir, 'requirements2.txt')
|
|
|
|
req2b_filename = os.path.join(self.venv_dir, 'requirements2b.txt')
|
|
|
|
|
|
|
|
with salt.utils.fopen(req1_filename, 'wb') as f:
|
|
|
|
f.write('-r requirements1b.txt\n')
|
|
|
|
with salt.utils.fopen(req1b_filename, 'wb') as f:
|
|
|
|
f.write('flake8\n')
|
|
|
|
with salt.utils.fopen(req2_filename, 'wb') as f:
|
|
|
|
f.write('-r requirements2b.txt\n')
|
|
|
|
with salt.utils.fopen(req2b_filename, 'wb') as f:
|
|
|
|
f.write('pep8\n')
|
|
|
|
|
|
|
|
this_user = pwd.getpwuid(os.getuid())[0]
|
|
|
|
requirements_list = [req1_filename, req2_filename]
|
|
|
|
|
|
|
|
ret = self.run_function(
|
|
|
|
'pip.install', requirements=requirements_list, user=this_user,
|
|
|
|
bin_env=self.venv_dir
|
|
|
|
)
|
|
|
|
try:
|
|
|
|
self.assertEqual(ret['retcode'], 0)
|
|
|
|
|
2015-12-28 17:19:05 +00:00
|
|
|
found = self.pip_successful_install(ret['stdout'])
|
2015-12-28 09:30:19 +00:00
|
|
|
|
|
|
|
self.assertTrue(found)
|
|
|
|
|
|
|
|
except (AssertionError, TypeError):
|
|
|
|
import pprint
|
|
|
|
pprint.pprint(ret)
|
|
|
|
raise
|
|
|
|
|
2015-12-27 03:30:27 +00:00
|
|
|
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
|
2015-12-28 17:19:05 +00:00
|
|
|
def test_requirements_as_list__sans_no_chown__absolute_file_path(self):
|
2015-12-27 03:30:27 +00:00
|
|
|
self.run_function('virtualenv.create', [self.venv_dir])
|
|
|
|
|
|
|
|
req1_filename = os.path.join(self.venv_dir, 'requirements.txt')
|
|
|
|
req2_filename = os.path.join(self.venv_dir, 'requirements2.txt')
|
|
|
|
|
|
|
|
with salt.utils.fopen(req1_filename, 'wb') as f:
|
|
|
|
f.write('flake8\n')
|
|
|
|
with salt.utils.fopen(req2_filename, 'wb') as f:
|
|
|
|
f.write('pep8\n')
|
|
|
|
|
|
|
|
this_user = pwd.getpwuid(os.getuid())[0]
|
|
|
|
requirements_list = [req1_filename, req2_filename]
|
|
|
|
|
|
|
|
ret = self.run_function(
|
|
|
|
'pip.install', requirements=requirements_list, user=this_user,
|
|
|
|
bin_env=self.venv_dir
|
|
|
|
)
|
|
|
|
|
2015-12-28 17:19:05 +00:00
|
|
|
found = self.pip_successful_install(ret['stdout'])
|
2015-12-27 03:30:27 +00:00
|
|
|
|
2015-12-28 17:19:05 +00:00
|
|
|
try:
|
|
|
|
self.assertEqual(ret['retcode'], 0)
|
2015-12-27 03:30:27 +00:00
|
|
|
self.assertTrue(found)
|
|
|
|
|
|
|
|
except (AssertionError, TypeError):
|
|
|
|
import pprint
|
|
|
|
pprint.pprint(ret)
|
|
|
|
raise
|
|
|
|
|
|
|
|
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
|
2015-12-28 17:19:05 +00:00
|
|
|
def test_requirements_as_list__sans_no_chown__non_absolute_file_path(self):
|
2015-12-27 03:30:27 +00:00
|
|
|
self.run_function('virtualenv.create', [self.venv_dir])
|
|
|
|
|
|
|
|
# Create a requirements file that depends on another one.
|
|
|
|
|
|
|
|
req1_filename = 'requirements.txt'
|
|
|
|
req2_filename = 'requirements2.txt'
|
|
|
|
req_cwd = self.venv_dir
|
|
|
|
|
|
|
|
req1_filepath = os.path.join(req_cwd, req1_filename)
|
|
|
|
req2_filepath = os.path.join(req_cwd, req2_filename)
|
|
|
|
|
|
|
|
with salt.utils.fopen(req1_filepath, 'wb') as f:
|
|
|
|
f.write('flake8\n')
|
|
|
|
with salt.utils.fopen(req2_filepath, 'wb') as f:
|
|
|
|
f.write('pep8\n')
|
|
|
|
|
|
|
|
this_user = pwd.getpwuid(os.getuid())[0]
|
|
|
|
requirements_list = [req1_filename, req2_filename]
|
|
|
|
|
|
|
|
ret = self.run_function(
|
|
|
|
'pip.install', requirements=requirements_list, user=this_user,
|
|
|
|
bin_env=self.venv_dir, cwd=req_cwd
|
|
|
|
)
|
|
|
|
try:
|
|
|
|
self.assertEqual(ret['retcode'], 0)
|
|
|
|
|
2015-12-28 17:19:05 +00:00
|
|
|
found = self.pip_successful_install(ret['stdout'])
|
2015-12-27 03:30:27 +00:00
|
|
|
self.assertTrue(found)
|
|
|
|
|
|
|
|
except (AssertionError, TypeError):
|
|
|
|
import pprint
|
|
|
|
pprint.pprint(ret)
|
|
|
|
raise
|
|
|
|
|
|
|
|
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
|
2015-12-28 17:19:05 +00:00
|
|
|
def test_chained_requirements__sans_no_chown__absolute_file_path(self):
|
2015-12-27 03:30:27 +00:00
|
|
|
self.run_function('virtualenv.create', [self.venv_dir])
|
|
|
|
|
|
|
|
# Create a requirements file that depends on another one.
|
|
|
|
|
|
|
|
req1_filename = os.path.join(self.venv_dir, 'requirements.txt')
|
|
|
|
req2_filename = os.path.join(self.venv_dir, 'requirements2.txt')
|
|
|
|
|
|
|
|
with salt.utils.fopen(req1_filename, 'wb') as f:
|
|
|
|
f.write('-r requirements2.txt')
|
|
|
|
with salt.utils.fopen(req2_filename, 'wb') as f:
|
|
|
|
f.write('pep8')
|
|
|
|
|
|
|
|
this_user = pwd.getpwuid(os.getuid())[0]
|
|
|
|
ret = self.run_function(
|
|
|
|
'pip.install', requirements=req1_filename, user=this_user,
|
|
|
|
bin_env=self.venv_dir
|
|
|
|
)
|
|
|
|
try:
|
|
|
|
self.assertEqual(ret['retcode'], 0)
|
|
|
|
self.assertIn('installed pep8', ret['stdout'])
|
|
|
|
except (AssertionError, TypeError):
|
|
|
|
import pprint
|
|
|
|
pprint.pprint(ret)
|
|
|
|
raise
|
|
|
|
|
|
|
|
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
|
2015-12-28 17:19:05 +00:00
|
|
|
def test_chained_requirements__sans_no_chown__non_absolute_file_path(self):
|
2015-12-27 03:30:27 +00:00
|
|
|
self.run_function('virtualenv.create', [self.venv_dir])
|
|
|
|
|
|
|
|
# Create a requirements file that depends on another one.
|
|
|
|
req_basepath = (self.venv_dir)
|
|
|
|
|
|
|
|
req1_filename = 'requirements.txt'
|
|
|
|
req2_filename = 'requirements2.txt'
|
|
|
|
|
|
|
|
req1_file = os.path.join(self.venv_dir, req1_filename)
|
|
|
|
req2_file = os.path.join(self.venv_dir, req2_filename)
|
|
|
|
|
|
|
|
with salt.utils.fopen(req1_file, 'wb') as f:
|
|
|
|
f.write('-r requirements2.txt')
|
|
|
|
with salt.utils.fopen(req2_file, 'wb') as f:
|
|
|
|
f.write('pep8')
|
|
|
|
|
|
|
|
this_user = pwd.getpwuid(os.getuid())[0]
|
|
|
|
ret = self.run_function(
|
|
|
|
'pip.install', requirements=req1_filename, user=this_user,
|
|
|
|
no_chown=False, cwd=req_basepath, bin_env=self.venv_dir
|
|
|
|
)
|
|
|
|
try:
|
|
|
|
self.assertEqual(ret['retcode'], 0)
|
|
|
|
self.assertIn('installed pep8', ret['stdout'])
|
|
|
|
except (AssertionError, TypeError):
|
|
|
|
import pprint
|
|
|
|
pprint.pprint(ret)
|
|
|
|
raise
|
|
|
|
|
2013-07-04 17:57:42 +00:00
|
|
|
@skipIf(os.geteuid() != 0, 'you must be root to run this test')
|
2013-07-26 23:40:36 +00:00
|
|
|
def test_issue_4805_nested_requirements_user_no_chown(self):
|
2013-05-05 03:09:50 +00:00
|
|
|
self.run_function('virtualenv.create', [self.venv_dir])
|
|
|
|
|
|
|
|
# Create a requirements file that depends on another one.
|
|
|
|
req1_filename = os.path.join(self.venv_dir, 'requirements.txt')
|
|
|
|
req2_filename = os.path.join(self.venv_dir, 'requirements2.txt')
|
2014-11-26 17:47:05 +00:00
|
|
|
with salt.utils.fopen(req1_filename, 'wb') as f:
|
2013-05-05 03:09:50 +00:00
|
|
|
f.write('-r requirements2.txt')
|
2014-11-26 17:47:05 +00:00
|
|
|
with salt.utils.fopen(req2_filename, 'wb') as f:
|
2013-05-05 03:09:50 +00:00
|
|
|
f.write('pep8')
|
|
|
|
|
|
|
|
this_user = pwd.getpwuid(os.getuid())[0]
|
2013-08-12 12:36:52 +00:00
|
|
|
ret = self.run_function(
|
|
|
|
'pip.install', requirements=req1_filename, user=this_user,
|
|
|
|
no_chown=True, bin_env=self.venv_dir
|
|
|
|
)
|
2013-07-04 17:57:42 +00:00
|
|
|
try:
|
|
|
|
self.assertEqual(ret['retcode'], 0)
|
|
|
|
self.assertIn('installed pep8', ret['stdout'])
|
|
|
|
except (AssertionError, TypeError):
|
|
|
|
import pprint
|
|
|
|
pprint.pprint(ret)
|
|
|
|
raise
|
2013-05-05 03:09:50 +00:00
|
|
|
|
2012-09-27 17:33:50 +00:00
|
|
|
def test_pip_uninstall(self):
|
|
|
|
# Let's create the testing virtualenv
|
|
|
|
self.run_function('virtualenv.create', [self.venv_dir])
|
|
|
|
ret = self.run_function('pip.install', ['pep8'], bin_env=self.venv_dir)
|
|
|
|
self.assertEqual(ret['retcode'], 0)
|
|
|
|
self.assertIn('installed pep8', ret['stdout'])
|
2012-12-11 10:23:37 +00:00
|
|
|
ret = self.run_function(
|
|
|
|
'pip.uninstall', ['pep8'], bin_env=self.venv_dir
|
|
|
|
)
|
2013-07-04 17:57:42 +00:00
|
|
|
try:
|
|
|
|
self.assertEqual(ret['retcode'], 0)
|
|
|
|
self.assertIn('uninstalled pep8', ret['stdout'])
|
|
|
|
except AssertionError:
|
|
|
|
import pprint
|
|
|
|
pprint.pprint(ret)
|
|
|
|
raise
|
2012-09-27 17:33:50 +00:00
|
|
|
|
2013-02-07 23:51:05 +00:00
|
|
|
def test_pip_install_upgrade(self):
|
|
|
|
# Create the testing virtualenv
|
|
|
|
self.run_function('virtualenv.create', [self.venv_dir])
|
|
|
|
ret = self.run_function(
|
2013-02-08 00:30:40 +00:00
|
|
|
'pip.install', ['pep8==1.3.4'], bin_env=self.venv_dir
|
2013-02-07 23:51:05 +00:00
|
|
|
)
|
2013-07-04 17:57:42 +00:00
|
|
|
try:
|
|
|
|
self.assertEqual(ret['retcode'], 0)
|
|
|
|
self.assertIn('installed pep8', ret['stdout'])
|
|
|
|
except AssertionError:
|
|
|
|
import pprint
|
|
|
|
pprint.pprint(ret)
|
|
|
|
raise
|
|
|
|
|
2013-02-07 23:51:05 +00:00
|
|
|
ret = self.run_function(
|
|
|
|
'pip.install',
|
|
|
|
['pep8'],
|
|
|
|
bin_env=self.venv_dir,
|
|
|
|
upgrade=True
|
|
|
|
)
|
2013-07-04 17:57:42 +00:00
|
|
|
|
|
|
|
try:
|
|
|
|
self.assertEqual(ret['retcode'], 0)
|
|
|
|
self.assertIn('installed pep8', ret['stdout'])
|
|
|
|
except AssertionError:
|
|
|
|
import pprint
|
|
|
|
pprint.pprint(ret)
|
|
|
|
raise
|
|
|
|
|
2013-02-07 23:51:05 +00:00
|
|
|
ret = self.run_function(
|
|
|
|
'pip.uninstall', ['pep8'], bin_env=self.venv_dir
|
|
|
|
)
|
2013-07-04 17:57:42 +00:00
|
|
|
|
|
|
|
try:
|
|
|
|
self.assertEqual(ret['retcode'], 0)
|
|
|
|
self.assertIn('uninstalled pep8', ret['stdout'])
|
|
|
|
except AssertionError:
|
|
|
|
import pprint
|
|
|
|
pprint.pprint(ret)
|
|
|
|
raise
|
|
|
|
|
|
|
|
def test_pip_install_multiple_editables(self):
|
|
|
|
editables = [
|
|
|
|
'git+https://github.com/jek/blinker.git#egg=Blinker',
|
|
|
|
'git+https://github.com/saltstack/salt-testing.git#egg=SaltTesting'
|
|
|
|
]
|
|
|
|
|
|
|
|
# Create the testing virtualenv
|
|
|
|
self.run_function('virtualenv.create', [self.venv_dir])
|
|
|
|
ret = self.run_function(
|
|
|
|
'pip.install', [],
|
|
|
|
editable='{0}'.format(','.join(editables)),
|
|
|
|
bin_env=self.venv_dir
|
|
|
|
)
|
|
|
|
try:
|
|
|
|
self.assertEqual(ret['retcode'], 0)
|
|
|
|
self.assertIn(
|
|
|
|
'Successfully installed Blinker SaltTesting', ret['stdout']
|
|
|
|
)
|
|
|
|
except AssertionError:
|
|
|
|
import pprint
|
|
|
|
pprint.pprint(ret)
|
|
|
|
raise
|
|
|
|
|
|
|
|
def test_pip_install_multiple_editables_and_pkgs(self):
|
|
|
|
editables = [
|
|
|
|
'git+https://github.com/jek/blinker.git#egg=Blinker',
|
|
|
|
'git+https://github.com/saltstack/salt-testing.git#egg=SaltTesting'
|
|
|
|
]
|
|
|
|
|
|
|
|
# Create the testing virtualenv
|
|
|
|
self.run_function('virtualenv.create', [self.venv_dir])
|
|
|
|
ret = self.run_function(
|
|
|
|
'pip.install', ['pep8'],
|
|
|
|
editable='{0}'.format(','.join(editables)),
|
|
|
|
bin_env=self.venv_dir
|
|
|
|
)
|
|
|
|
try:
|
|
|
|
self.assertEqual(ret['retcode'], 0)
|
2015-04-20 13:45:25 +00:00
|
|
|
for package in ('Blinker', 'SaltTesting', 'pep8'):
|
|
|
|
self.assertRegexpMatches(
|
|
|
|
ret['stdout'],
|
|
|
|
r'(?:.*)(Successfully installed)(?:.*)({0})(?:.*)'.format(package)
|
|
|
|
)
|
2013-07-04 17:57:42 +00:00
|
|
|
except AssertionError:
|
|
|
|
import pprint
|
|
|
|
pprint.pprint(ret)
|
|
|
|
raise
|
2013-02-07 23:51:05 +00:00
|
|
|
|
2012-09-27 11:06:09 +00:00
|
|
|
def tearDown(self):
|
|
|
|
super(PipModuleTest, self).tearDown()
|
|
|
|
if os.path.isdir(self.venv_test_dir):
|
|
|
|
shutil.rmtree(self.venv_test_dir)
|
2013-07-04 17:57:42 +00:00
|
|
|
if os.path.isdir(self.pip_temp):
|
|
|
|
shutil.rmtree(self.pip_temp)
|
2013-06-25 08:24:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
from integration import run_tests
|
|
|
|
run_tests(PipModuleTest)
|