Commit bf61dd56 by Arun Babu Neelicattu Committed by Steph Samson

tests: cleanup cache and http usage

- ensure tests rely on temporary cache directory
- remove external http call requirement for lock --no-update

Relates-to: #1645
parent 6ddd58f8
...@@ -10,8 +10,8 @@ def test_config_get_default_value(config, name, value): ...@@ -10,8 +10,8 @@ def test_config_get_default_value(config, name, value):
assert config.get(name) is value assert config.get(name) is value
def test_config_get_processes_depended_on_values(config): def test_config_get_processes_depended_on_values(config, config_cache_dir):
assert os.path.join("/foo", "virtualenvs") == config.get("virtualenvs.path") assert str(config_cache_dir / "virtualenvs") == config.get("virtualenvs.path")
@pytest.mark.parametrize( @pytest.mark.parametrize(
......
...@@ -54,9 +54,21 @@ class Config(BaseConfig): ...@@ -54,9 +54,21 @@ class Config(BaseConfig):
@pytest.fixture @pytest.fixture
def config_source(): def config_cache_dir(tmp_dir):
path = Path(tmp_dir) / ".cache" / "pypoetry"
path.mkdir(parents=True)
return path
@pytest.fixture
def config_virtualenvs_path(config_cache_dir):
return config_cache_dir / "virtualenvs"
@pytest.fixture
def config_source(config_cache_dir):
source = DictConfigSource() source = DictConfigSource()
source.add_property("cache-dir", "/foo") source.add_property("cache-dir", str(config_cache_dir))
return source return source
...@@ -226,6 +238,7 @@ def project_factory(tmp_dir, config, repo, installed, default_python): ...@@ -226,6 +238,7 @@ def project_factory(tmp_dir, config, repo, installed, default_python):
dependencies=None, dependencies=None,
dev_dependencies=None, dev_dependencies=None,
pyproject_content=None, pyproject_content=None,
poetry_lock_content=None,
install_deps=True, install_deps=True,
): ):
project_dir = workspace / "poetry-fixture-{}".format(name) project_dir = workspace / "poetry-fixture-{}".format(name)
...@@ -249,6 +262,10 @@ def project_factory(tmp_dir, config, repo, installed, default_python): ...@@ -249,6 +262,10 @@ def project_factory(tmp_dir, config, repo, installed, default_python):
dev_dependencies=dev_dependencies, dev_dependencies=dev_dependencies,
).create(project_dir, with_tests=False) ).create(project_dir, with_tests=False)
if poetry_lock_content:
lock_file = project_dir / "poetry.lock"
lock_file.write_text(data=poetry_lock_content, encoding="utf-8")
poetry = Factory().create_poetry(project_dir) poetry = Factory().create_poetry(project_dir)
locker = TestLocker( locker = TestLocker(
......
...@@ -25,37 +25,41 @@ def test_show_config_with_local_config_file_empty(tester, mocker): ...@@ -25,37 +25,41 @@ def test_show_config_with_local_config_file_empty(tester, mocker):
assert "" == tester.io.fetch_output() assert "" == tester.io.fetch_output()
def test_list_displays_default_value_if_not_set(tester, config): def test_list_displays_default_value_if_not_set(tester, config, config_cache_dir):
tester.execute("--list") tester.execute("--list")
expected = """cache-dir = "/foo" expected = """cache-dir = {cache}
experimental.new-installer = true experimental.new-installer = true
installer.parallel = true installer.parallel = true
virtualenvs.create = true virtualenvs.create = true
virtualenvs.in-project = null virtualenvs.in-project = null
virtualenvs.options.always-copy = false virtualenvs.options.always-copy = false
virtualenvs.path = {path} # /foo{sep}virtualenvs virtualenvs.path = {path} # {virtualenvs}
""".format( """.format(
path=json.dumps(os.path.join("{cache-dir}", "virtualenvs")), sep=os.path.sep cache=json.dumps(str(config_cache_dir)),
path=json.dumps(os.path.join("{cache-dir}", "virtualenvs")),
virtualenvs=str(config_cache_dir / "virtualenvs"),
) )
assert expected == tester.io.fetch_output() assert expected == tester.io.fetch_output()
def test_list_displays_set_get_setting(tester, config): def test_list_displays_set_get_setting(tester, config, config_cache_dir):
tester.execute("virtualenvs.create false") tester.execute("virtualenvs.create false")
tester.execute("--list") tester.execute("--list")
expected = """cache-dir = "/foo" expected = """cache-dir = {cache}
experimental.new-installer = true experimental.new-installer = true
installer.parallel = true installer.parallel = true
virtualenvs.create = false virtualenvs.create = false
virtualenvs.in-project = null virtualenvs.in-project = null
virtualenvs.options.always-copy = false virtualenvs.options.always-copy = false
virtualenvs.path = {path} # /foo{sep}virtualenvs virtualenvs.path = {path} # {virtualenvs}
""".format( """.format(
path=json.dumps(os.path.join("{cache-dir}", "virtualenvs")), sep=os.path.sep cache=json.dumps(str(config_cache_dir)),
path=json.dumps(os.path.join("{cache-dir}", "virtualenvs")),
virtualenvs=str(config_cache_dir / "virtualenvs"),
) )
assert 0 == config.set_config_source.call_count assert 0 == config.set_config_source.call_count
...@@ -83,20 +87,22 @@ def test_display_single_local_setting(command_tester_factory, fixture_dir): ...@@ -83,20 +87,22 @@ def test_display_single_local_setting(command_tester_factory, fixture_dir):
assert expected == tester.io.fetch_output() assert expected == tester.io.fetch_output()
def test_list_displays_set_get_local_setting(tester, config): def test_list_displays_set_get_local_setting(tester, config, config_cache_dir):
tester.execute("virtualenvs.create false --local") tester.execute("virtualenvs.create false --local")
tester.execute("--list") tester.execute("--list")
expected = """cache-dir = "/foo" expected = """cache-dir = {cache}
experimental.new-installer = true experimental.new-installer = true
installer.parallel = true installer.parallel = true
virtualenvs.create = false virtualenvs.create = false
virtualenvs.in-project = null virtualenvs.in-project = null
virtualenvs.options.always-copy = false virtualenvs.options.always-copy = false
virtualenvs.path = {path} # /foo{sep}virtualenvs virtualenvs.path = {path} # {virtualenvs}
""".format( """.format(
path=json.dumps(os.path.join("{cache-dir}", "virtualenvs")), sep=os.path.sep cache=json.dumps(str(config_cache_dir)),
path=json.dumps(os.path.join("{cache-dir}", "virtualenvs")),
virtualenvs=str(config_cache_dir / "virtualenvs"),
) )
assert 1 == config.set_config_source.call_count assert 1 == config.set_config_source.call_count
......
import shutil
import pytest import pytest
from poetry.factory import Factory
from poetry.packages import Locker from poetry.packages import Locker
from poetry.utils._compat import Path from poetry.utils._compat import Path
from tests.helpers import get_package
@pytest.fixture @pytest.fixture
...@@ -18,15 +16,26 @@ def tester(command_tester_factory): ...@@ -18,15 +16,26 @@ def tester(command_tester_factory):
@pytest.fixture @pytest.fixture
def poetry_with_old_lockfile(fixture_dir, source_dir): def poetry_with_old_lockfile(project_factory, fixture_dir, source_dir):
project_dir = source_dir / "project" source = fixture_dir("old_lock")
shutil.copytree(str(fixture_dir("old_lock")), str(project_dir)) pyproject_content = (source / "pyproject.toml").read_text(encoding="utf-8")
poetry = Factory().create_poetry(cwd=project_dir) poetry_lock_content = (source / "poetry.lock").read_text(encoding="utf-8")
return poetry return project_factory(
name="foobar",
pyproject_content=pyproject_content,
poetry_lock_content=poetry_lock_content,
)
def test_lock_no_update(command_tester_factory, poetry_with_old_lockfile, repo):
repo.add_package(get_package("sampleproject", "1.3.1"))
repo.add_package(get_package("sampleproject", "2.0.0"))
def test_lock_no_update(command_tester_factory, poetry_with_old_lockfile, http): locker = Locker(
http.disable() lock=poetry_with_old_lockfile.pyproject.file.path.parent / "poetry.lock",
local_config=poetry_with_old_lockfile.locker._local_config,
)
poetry_with_old_lockfile.set_locker(locker)
locked_repository = poetry_with_old_lockfile.locker.locked_repository( locked_repository = poetry_with_old_lockfile.locker.locked_repository(
with_dev_reqs=True with_dev_reqs=True
......
[[package]] [[package]]
category = "main" category = "main"
description = "Python package for providing Mozilla's CA Bundle." description = "A sample Python project"
name = "certifi" name = "sampleproject"
optional = false
python-versions = "*"
version = "2020.6.20"
[[package]]
category = "main"
description = "Universal encoding detector for Python 2 and 3"
name = "chardet"
optional = false
python-versions = "*"
version = "3.0.4"
[[package]]
category = "main"
description = "A Python library for the Docker Engine API."
name = "docker"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
version = "4.3.1"
[package.dependencies]
pywin32 = "227"
requests = ">=2.14.2,<2.18.0 || >2.18.0"
six = ">=1.4.0"
websocket-client = ">=0.32.0"
[package.extras]
ssh = ["paramiko (>=2.4.2)"]
tls = ["pyOpenSSL (>=17.5.0)", "cryptography (>=1.3.4)", "idna (>=2.0.0)"]
[[package]]
category = "main"
description = "Internationalized Domain Names in Applications (IDNA)"
name = "idna"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "2.10"
[[package]]
category = "main"
description = "Python for Window Extensions"
marker = "sys_platform == \"win32\""
name = "pywin32"
optional = false
python-versions = "*"
version = "227"
[[package]]
category = "main"
description = "Python HTTP for Humans."
name = "requests"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
version = "2.24.0"
[package.dependencies]
certifi = ">=2017.4.17"
chardet = ">=3.0.2,<4"
idna = ">=2.5,<3"
urllib3 = ">=1.21.1,<1.25.0 || >1.25.0,<1.25.1 || >1.25.1,<1.26"
[package.extras]
security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"]
socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"]
[[package]]
category = "main"
description = "Python 2 and 3 compatibility utilities"
name = "six"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
version = "1.15.0"
[[package]]
category = "main"
description = "HTTP library with thread-safe connection pooling, file post, and more."
name = "urllib3"
optional = false optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
version = "1.25.10" version = "1.3.1"
[package.extras]
brotli = ["brotlipy (>=0.6.0)"]
secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "pyOpenSSL (>=0.14)", "ipaddress"]
socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"]
[[package]]
category = "main"
description = "WebSocket client for Python. hybi13 is supported."
name = "websocket-client"
optional = false
python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "0.57.0"
[package.dependencies]
six = "*"
[metadata] [metadata]
content-hash = "bb4c2f3c089b802c1930b6acbeed04711d93e9cdfd9a003eb17518a6d9f350c6" content-hash = "c8c2c9d899e47bac3972e029ef0e71b75d5df98a28eebef25a75640a19aac177"
lock-version = "1.0" lock-version = "1.0"
python-versions = "^3.8" python-versions = "^3.8"
[metadata.files] [metadata.files]
certifi = [ sampleproject = [
{file = "certifi-2020.6.20-py2.py3-none-any.whl", hash = "sha256:8fc0819f1f30ba15bdb34cceffb9ef04d99f420f68eb75d901e9560b8749fc41"}, {file = "sampleproject-1.3.1-py2.py3-none-any.whl", hash = "sha256:26c9172e08244873b0e09c574a229bf2c251c67723a05e08fd3ec0c5ee423796"},
{file = "certifi-2020.6.20.tar.gz", hash = "sha256:5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3"}, {file = "sampleproject-1.3.1-py3-none-any.whl", hash = "sha256:75bb5bb4e74a1b77dc0cff25ebbacb54fe1318aaf99a86a036cefc86ed885ced"},
] {file = "sampleproject-1.3.1.tar.gz", hash = "sha256:3593ca2f1e057279d70d6144b14472fb28035b1da213dde60906b703d6f82c55"},
chardet = [
{file = "chardet-3.0.4-py2.py3-none-any.whl", hash = "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"},
{file = "chardet-3.0.4.tar.gz", hash = "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"},
]
docker = [
{file = "docker-4.3.1-py2.py3-none-any.whl", hash = "sha256:13966471e8bc23b36bfb3a6fb4ab75043a5ef1dac86516274777576bed3b9828"},
{file = "docker-4.3.1.tar.gz", hash = "sha256:bad94b8dd001a8a4af19ce4becc17f41b09f228173ffe6a4e0355389eef142f2"},
]
idna = [
{file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"},
{file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"},
]
pywin32 = [
{file = "pywin32-227-cp27-cp27m-win32.whl", hash = "sha256:371fcc39416d736401f0274dd64c2302728c9e034808e37381b5e1b22be4a6b0"},
{file = "pywin32-227-cp27-cp27m-win_amd64.whl", hash = "sha256:4cdad3e84191194ea6d0dd1b1b9bdda574ff563177d2adf2b4efec2a244fa116"},
{file = "pywin32-227-cp35-cp35m-win32.whl", hash = "sha256:f4c5be1a293bae0076d93c88f37ee8da68136744588bc5e2be2f299a34ceb7aa"},
{file = "pywin32-227-cp35-cp35m-win_amd64.whl", hash = "sha256:a929a4af626e530383a579431b70e512e736e9588106715215bf685a3ea508d4"},
{file = "pywin32-227-cp36-cp36m-win32.whl", hash = "sha256:300a2db938e98c3e7e2093e4491439e62287d0d493fe07cce110db070b54c0be"},
{file = "pywin32-227-cp36-cp36m-win_amd64.whl", hash = "sha256:9b31e009564fb95db160f154e2aa195ed66bcc4c058ed72850d047141b36f3a2"},
{file = "pywin32-227-cp37-cp37m-win32.whl", hash = "sha256:47a3c7551376a865dd8d095a98deba954a98f326c6fe3c72d8726ca6e6b15507"},
{file = "pywin32-227-cp37-cp37m-win_amd64.whl", hash = "sha256:31f88a89139cb2adc40f8f0e65ee56a8c585f629974f9e07622ba80199057511"},
{file = "pywin32-227-cp38-cp38-win32.whl", hash = "sha256:7f18199fbf29ca99dff10e1f09451582ae9e372a892ff03a28528a24d55875bc"},
{file = "pywin32-227-cp38-cp38-win_amd64.whl", hash = "sha256:7c1ae32c489dc012930787f06244426f8356e129184a02c25aef163917ce158e"},
{file = "pywin32-227-cp39-cp39-win32.whl", hash = "sha256:c054c52ba46e7eb6b7d7dfae4dbd987a1bb48ee86debe3f245a2884ece46e295"},
{file = "pywin32-227-cp39-cp39-win_amd64.whl", hash = "sha256:f27cec5e7f588c3d1051651830ecc00294f90728d19c3bf6916e6dba93ea357c"},
]
requests = [
{file = "requests-2.24.0-py2.py3-none-any.whl", hash = "sha256:fe75cc94a9443b9246fc7049224f75604b113c36acb93f87b80ed42c44cbb898"},
{file = "requests-2.24.0.tar.gz", hash = "sha256:b3559a131db72c33ee969480840fff4bb6dd111de7dd27c8ee1f820f4f00231b"},
]
six = [
{file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"},
{file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"},
]
urllib3 = [
{file = "urllib3-1.25.10-py2.py3-none-any.whl", hash = "sha256:e7983572181f5e1522d9c98453462384ee92a0be7fac5f1413a1e35c56cc0461"},
{file = "urllib3-1.25.10.tar.gz", hash = "sha256:91056c15fa70756691db97756772bb1eb9678fa585d9184f24534b100dc60f4a"},
]
websocket-client = [
{file = "websocket_client-0.57.0-py2.py3-none-any.whl", hash = "sha256:0fc45c961324d79c781bab301359d5a1b00b13ad1b10415a4780229ef71a5549"},
{file = "websocket_client-0.57.0.tar.gz", hash = "sha256:d735b91d6d1692a6a181f2a8c9e0238e5f6373356f561bb9dc4c7af36f452010"},
] ]
...@@ -6,7 +6,7 @@ authors = ["Poetry Developer <developer@python-poetry.org>"] ...@@ -6,7 +6,7 @@ authors = ["Poetry Developer <developer@python-poetry.org>"]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.8" python = "^3.8"
docker = "^4.3.1" sampleproject = ">=1.3.1"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
......
...@@ -60,7 +60,7 @@ def test_get_cached_archives_for_link(config, mocker): ...@@ -60,7 +60,7 @@ def test_get_cached_archives_for_link(config, mocker):
} }
def test_get_cache_directory_for_link(config): def test_get_cache_directory_for_link(config, config_cache_dir):
chef = Chef( chef = Chef(
config, config,
MockEnv( MockEnv(
...@@ -71,8 +71,11 @@ def test_get_cache_directory_for_link(config): ...@@ -71,8 +71,11 @@ def test_get_cache_directory_for_link(config):
directory = chef.get_cache_directory_for_link( directory = chef.get_cache_directory_for_link(
Link("https://files.python-poetry.org/poetry-1.1.0.tar.gz") Link("https://files.python-poetry.org/poetry-1.1.0.tar.gz")
) )
expected = Path( expected = Path(
"/foo/artifacts/ba/63/13/283a3b3b7f95f05e9e6f84182d276f7bb0951d5b0cc24422b33f7a4648" "{}/artifacts/ba/63/13/283a3b3b7f95f05e9e6f84182d276f7bb0951d5b0cc24422b33f7a4648".format(
config_cache_dir.as_posix()
)
) )
assert expected == directory assert expected == directory
...@@ -126,9 +126,11 @@ Package operations: 4 installs, 1 update, 1 removal ...@@ -126,9 +126,11 @@ Package operations: 4 installs, 1 update, 1 removal
assert 5 == len(env.executed) assert 5 == len(env.executed)
def test_execute_shows_skipped_operations_if_verbose(config, pool, io): def test_execute_shows_skipped_operations_if_verbose(
config, pool, io, config_cache_dir
):
config = Config() config = Config()
config.merge({"cache-dir": "/foo"}) config.merge({"cache-dir": config_cache_dir.as_posix()})
env = MockEnv() env = MockEnv()
executor = Executor(env, pool, config, io) executor = Executor(env, pool, config, io)
......
...@@ -176,9 +176,9 @@ if __name__ == '__main__': ...@@ -176,9 +176,9 @@ if __name__ == '__main__':
def test_builder_falls_back_on_setup_and_pip_for_packages_with_build_scripts( def test_builder_falls_back_on_setup_and_pip_for_packages_with_build_scripts(
extended_poetry, extended_poetry, tmp_dir
): ):
env = MockEnv(path=Path("/foo")) env = MockEnv(path=Path(tmp_dir) / "foo")
builder = EditableBuilder(extended_poetry, env, NullIO()) builder = EditableBuilder(extended_poetry, env, NullIO())
builder.build() builder.build()
...@@ -219,8 +219,8 @@ def test_builder_installs_proper_files_when_packages_configured( ...@@ -219,8 +219,8 @@ def test_builder_installs_proper_files_when_packages_configured(
assert len(paths) == len(expected) assert len(paths) == len(expected)
def test_builder_should_execute_build_scripts(extended_without_setup_poetry): def test_builder_should_execute_build_scripts(extended_without_setup_poetry, tmp_dir):
env = MockEnv(path=Path("/foo")) env = MockEnv(path=Path(tmp_dir) / "foo")
builder = EditableBuilder(extended_without_setup_poetry, env, NullIO()) builder = EditableBuilder(extended_without_setup_poetry, env, NullIO())
builder.build() builder.build()
......
...@@ -642,7 +642,7 @@ def test_run_with_input_non_zero_return(tmp_dir, tmp_venv): ...@@ -642,7 +642,7 @@ def test_run_with_input_non_zero_return(tmp_dir, tmp_venv):
def test_create_venv_tries_to_find_a_compatible_python_executable_using_generic_ones_first( def test_create_venv_tries_to_find_a_compatible_python_executable_using_generic_ones_first(
manager, poetry, config, mocker manager, poetry, config, mocker, config_virtualenvs_path
): ):
if "VIRTUAL_ENV" in os.environ: if "VIRTUAL_ENV" in os.environ:
del os.environ["VIRTUAL_ENV"] del os.environ["VIRTUAL_ENV"]
...@@ -662,14 +662,14 @@ def test_create_venv_tries_to_find_a_compatible_python_executable_using_generic_ ...@@ -662,14 +662,14 @@ def test_create_venv_tries_to_find_a_compatible_python_executable_using_generic_
manager.create_venv(NullIO()) manager.create_venv(NullIO())
m.assert_called_with( m.assert_called_with(
Path("/foo/virtualenvs/{}-py3.7".format(venv_name)), config_virtualenvs_path / "{}-py3.7".format(venv_name),
executable="python3", executable="python3",
flags={"always-copy": False}, flags={"always-copy": False},
) )
def test_create_venv_tries_to_find_a_compatible_python_executable_using_specific_ones( def test_create_venv_tries_to_find_a_compatible_python_executable_using_specific_ones(
manager, poetry, config, mocker manager, poetry, config, mocker, config_virtualenvs_path
): ):
if "VIRTUAL_ENV" in os.environ: if "VIRTUAL_ENV" in os.environ:
del os.environ["VIRTUAL_ENV"] del os.environ["VIRTUAL_ENV"]
...@@ -688,7 +688,7 @@ def test_create_venv_tries_to_find_a_compatible_python_executable_using_specific ...@@ -688,7 +688,7 @@ def test_create_venv_tries_to_find_a_compatible_python_executable_using_specific
manager.create_venv(NullIO()) manager.create_venv(NullIO())
m.assert_called_with( m.assert_called_with(
Path("/foo/virtualenvs/{}-py3.9".format(venv_name)), config_virtualenvs_path / "{}-py3.9".format(venv_name),
executable="python3.9", executable="python3.9",
flags={"always-copy": False}, flags={"always-copy": False},
) )
...@@ -749,7 +749,7 @@ def test_create_venv_does_not_try_to_find_compatible_versions_with_executable( ...@@ -749,7 +749,7 @@ def test_create_venv_does_not_try_to_find_compatible_versions_with_executable(
def test_create_venv_uses_patch_version_to_detect_compatibility( def test_create_venv_uses_patch_version_to_detect_compatibility(
manager, poetry, config, mocker manager, poetry, config, mocker, config_virtualenvs_path
): ):
if "VIRTUAL_ENV" in os.environ: if "VIRTUAL_ENV" in os.environ:
del os.environ["VIRTUAL_ENV"] del os.environ["VIRTUAL_ENV"]
...@@ -773,18 +773,15 @@ def test_create_venv_uses_patch_version_to_detect_compatibility( ...@@ -773,18 +773,15 @@ def test_create_venv_uses_patch_version_to_detect_compatibility(
assert not check_output.called assert not check_output.called
m.assert_called_with( m.assert_called_with(
Path( config_virtualenvs_path
"/foo/virtualenvs/{}-py{}.{}".format( / "{}-py{}.{}".format(venv_name, version.major, version.minor),
venv_name, version.major, version.minor
)
),
executable=None, executable=None,
flags={"always-copy": False}, flags={"always-copy": False},
) )
def test_create_venv_uses_patch_version_to_detect_compatibility_with_executable( def test_create_venv_uses_patch_version_to_detect_compatibility_with_executable(
manager, poetry, config, mocker manager, poetry, config, mocker, config_virtualenvs_path
): ):
if "VIRTUAL_ENV" in os.environ: if "VIRTUAL_ENV" in os.environ:
del os.environ["VIRTUAL_ENV"] del os.environ["VIRTUAL_ENV"]
...@@ -811,11 +808,8 @@ def test_create_venv_uses_patch_version_to_detect_compatibility_with_executable( ...@@ -811,11 +808,8 @@ def test_create_venv_uses_patch_version_to_detect_compatibility_with_executable(
assert check_output.called assert check_output.called
m.assert_called_with( m.assert_called_with(
Path( config_virtualenvs_path
"/foo/virtualenvs/{}-py{}.{}".format( / "{}-py{}.{}".format(venv_name, version.major, version.minor - 1),
venv_name, version.major, version.minor - 1
)
),
executable="python{}.{}".format(version.major, version.minor - 1), executable="python{}.{}".format(version.major, version.minor - 1),
flags={"always-copy": False}, flags={"always-copy": False},
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment