def test_virtualenv_via_sys(self): with TemporaryVenv(use_virtualenv=True) as envdir: with Venv(envdir): self.assertEqual( str(sys.version_info), str(subprocess.check_output([ "python", "-c", SYS_TEST_CODE ], universal_newlines=True).strip()) )
def test_python_actually_found(self): with Venv(self.venv): internal_prefix = subprocess.check_output([ "python", "-c", VENV_PYTHON_TEST_CODE ], universal_newlines=True).strip() self.assertEqual(internal_prefix, self.venv)
def test_path_added(self): with Venv(self.venv): self.assertTrue(os.environ["PATH"].find(self.venv) > -1)
def test_correct_venv(self): with Venv(self.venv): self.assertEqual(os.environ["VIRTUAL_ENV"], self.venv)
def test_no_pythonhome(self): with Venv(self.venv): with self.assertRaises(KeyError): os.environ["PYTHONHOME"]
def test_python_actually_found(self): with Venv(self.virtualenv): internal_prefix = subprocess.check_output([ "python", "-c", VENV_PYTHON_TEST_CODE ]).strip() self.assertEqual(internal_prefix.decode("utf8"), self.virtualenv)
def test_Venv_fail(self): self.assertRaises(RuntimeError,Venv(self.empty_folder).__enter__)
def test_virtualenv_via_activation(self): with TemporaryVenv(use_virtualenv=True) as envdir: with Venv(envdir): self.assertTrue(True)
def test_default_via_activation(self): with TemporaryVenv() as envdir: with Venv(envdir): self.assertTrue(True)