Reuse virtualenv for all supervisor tests

This commit is contained in:
Ollie Walsh 2013-05-29 12:54:57 +01:00
parent 59dbcc4375
commit 32b80759d7
2 changed files with 13 additions and 9 deletions

View File

@ -14,16 +14,19 @@ class SupervisordModuleTest(integration.ModuleCase):
ret = self.run_function('cmd.has_exec', ['virtualenv'])
if not ret:
self.skipTest('virtualenv not installed')
self.venv_test_dir = tempfile.mkdtemp()
self.venv_test_dir = os.path.join(integration.TMP, 'supervisortests')
self.venv_dir = os.path.join(self.venv_test_dir, 'venv')
self.supervisor_sock = os.path.join(self.venv_dir, 'supervisor.sock')
self.run_function('virtualenv.create', [self.venv_dir])
self.run_function('pip.install', [], pkgs='supervisor', bin_env=self.venv_dir)
if not os.path.exists(self.venv_dir):
os.makedirs(self.venv_test_dir)
self.run_function('virtualenv.create', [self.venv_dir])
self.run_function('pip.install', [], pkgs='supervisor', bin_env=self.venv_dir)
self.supervisord = os.path.join(self.venv_dir, 'bin', 'supervisord')
if not os.path.exists(self.supervisord):
self.skipTest('Failed to installe supervisor in test virtualenv')
self.skipTest('Failed to install supervisor in test virtualenv')
self.supervisor_conf = os.path.join(self.venv_dir, 'supervisor.conf')
def start_supervisord(self, autostart=True):
@ -55,7 +58,6 @@ class SupervisordModuleTest(integration.ModuleCase):
if hasattr(self, 'supervisor_proc') and self.supervisor_proc.poll() is not None:
self.run_function('supervisord.custom', ['shutdown'], conf_file=self.supervisor_conf, bin_env=self.venv_dir)
self.supervisor_proc.wait()
self.run_function('file.remove', [self.venv_test_dir])
def test_start_all(self):
'''

View File

@ -19,12 +19,15 @@ class SupervisordTest(integration.ModuleCase,
ret = self.run_function('cmd.has_exec', ['virtualenv'])
if not ret:
self.skipTest('virtualenv not installed')
self.venv_test_dir = tempfile.mkdtemp()
self.venv_test_dir = os.path.join(integration.TMP, 'supervisortests')
self.venv_dir = os.path.join(self.venv_test_dir, 'venv')
self.supervisor_sock = os.path.join(self.venv_dir, 'supervisor.sock')
self.run_function('virtualenv.create', [self.venv_dir])
self.run_function('pip.install', [], pkgs='supervisor', bin_env=self.venv_dir)
if not os.path.exists(self.venv_dir):
os.makedirs(self.venv_test_dir)
self.run_function('virtualenv.create', [self.venv_dir])
self.run_function('pip.install', [], pkgs='supervisor', bin_env=self.venv_dir)
self.supervisord = os.path.join(self.venv_dir, 'bin', 'supervisord')
if not os.path.exists(self.supervisord):
@ -60,7 +63,6 @@ class SupervisordTest(integration.ModuleCase,
if hasattr(self, 'supervisor_proc') and self.supervisor_proc.poll() is not None:
self.run_function('supervisord.custom', ['shutdown'], conf_file=self.supervisor_conf, bin_env=self.venv_dir)
self.supervisor_proc.wait()
self.run_function('file.remove', [self.venv_test_dir])
def test_running_stopped(self):
'''