def test_venv(): with temp_chdir() as d: d = os.path.join(d, 'test_env') create_venv(d) global_python = get_python_path() with venv(d): venv_python = get_python_path() assert global_python != venv_python assert global_python == get_python_path()
def create_venv(d, pypath=None, verbose=False): command = ['virtualenv', d, '-p', pypath or get_python_path()] if not verbose: # no cov command.append('--quiet') subprocess.run(command, shell=NEED_SUBPROCESS_SHELL)
def test_pypath(): with temp_chdir() as d: d = os.path.join(d, 'test_env') create_venv(d, pypath=get_python_path()) assert os.path.exists(d)