Fix Travis-CI for unit.modules.virtualenv_test.VirtualenvTestCase.test_no_site_packages_deprecation

Also mock the `virtualenv` module.
This commit is contained in:
Pedro Algarvio 2013-07-13 23:23:30 +01:00
parent b6471e4099
commit c65b1348fe

View File

@ -190,15 +190,19 @@ class VirtualenvTestCase(TestCase):
mock = MagicMock(return_value={'retcode': 0, 'stdout': ''}) mock = MagicMock(return_value={'retcode': 0, 'stdout': ''})
with patch.dict(virtualenv_mod.__salt__, {'cmd.run_all': mock}): with patch.dict(virtualenv_mod.__salt__, {'cmd.run_all': mock}):
with warnings.catch_warnings(record=True) as w: virtualenv_mock = MagicMock()
virtualenv_mod.create( virtualenv_mock.__version__ = '1.9.1'
'/tmp/foo', no_site_packages=True with patch.dict('sys.modules', {'virtualenv': virtualenv_mock}):
) with warnings.catch_warnings(record=True) as w:
self.assertEqual( virtualenv_mod.create(
'\'no_site_packages\' has been deprecated. Please start ' '/tmp/foo', no_site_packages=True
'using \'system_site_packages=False\' which means exactly ' )
'the same as \'no_site_packages=True\'', str(w[-1].message) self.assertEqual(
) '\'no_site_packages\' has been deprecated. Please '
'start using \'system_site_packages=False\' which '
'means exactly the same as \'no_site_packages=True\'',
str(w[-1].message)
)
@patch('salt.utils.which', lambda bin_name: bin_name) @patch('salt.utils.which', lambda bin_name: bin_name)
def test_unapplicable_options(self): def test_unapplicable_options(self):