def execution_handler(*args, **kwargs):
     try:
         shutil.rmtree(TEST_VENV)
     except:
         pass
     utils.make_virtualenv(TEST_VENV)
     func(*args, **kwargs)
     shutil.rmtree(TEST_VENV)
 def execution_handler(*args, **kwargs):
     try:
         shutil.rmtree(TEST_VENV)
     except:
         pass
     utils.make_virtualenv(TEST_VENV)
     func(*args, **kwargs)
     shutil.rmtree(TEST_VENV)
 def test_create_agent_package_in_existing_venv_force(self):
     cli_options = {
         '--config': CONFIG_FILE,
         '--force': True,
         '--dryrun': False,
         '--no-validation': False,
         '--verbose': True
     }
     utils.make_virtualenv(TEST_VENV)
     try:
         cli._run(cli_options)
     finally:
         shutil.rmtree(TEST_VENV)
 def test_create_agent_package_in_existing_venv_force(self):
     cli_options = {
         '--config': CONFIG_FILE,
         '--force': True,
         '--dryrun': False,
         '--no-validation': False,
         '--verbose': True
     }
     utils.make_virtualenv(TEST_VENV)
     try:
         cli._run(cli_options)
     finally:
         shutil.rmtree(TEST_VENV)
 def test_create_agent_package_in_existing_venv_no_force(self):
     cli_options = {
         '--config': CONFIG_FILE,
         '--force': False,
         '--dryrun': False,
         '--no-validation': False,
         '--verbose': True
     }
     utils.make_virtualenv(TEST_VENV)
     try:
         e = self.assertRaises(SystemExit, cli._run, cli_options)
         self.assertEqual(e.message,
                          codes.errors['virtualenv_already_exists'])
     finally:
         shutil.rmtree(TEST_VENV)
 def test_create_agent_package_in_existing_venv_no_force(self):
     cli_options = {
         '--config': CONFIG_FILE,
         '--force': False,
         '--dryrun': False,
         '--no-validation': False,
         '--verbose': True
     }
     utils.make_virtualenv(TEST_VENV)
     try:
         e = self.assertRaises(SystemExit, cli._run, cli_options)
         self.assertEqual(
             e.message, codes.errors['virtualenv_already_exists'])
     finally:
         shutil.rmtree(TEST_VENV)
 def execution_handler(*args, **kwargs):
     utils.make_virtualenv(TEST_VENV)
     func(*args, **kwargs)
     shutil.rmtree(TEST_VENV)