From d048899c80d520c6e10a873f0d91d4da015036e0 Mon Sep 17 00:00:00 2001 From: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com> Date: Thu, 18 May 2023 10:04:28 -0500 Subject: [PATCH] split up fixtures --- tests/console/commands/test_install.py | 5 +- tests/console/commands/test_lock.py | 27 ----- .../missing-bak/pyproject.toml | 11 +++ .../missing_directory_dependency/poetry.lock | 98 ++++++++++++++++++- .../pyproject.toml | 2 - .../missing-bak/pyproject.toml | 10 ++ .../poetry.lock | 20 ++++ .../pyproject.toml | 13 +++ .../poetry.lock | 0 .../pyproject.toml | 0 tests/installation/test_installer.py | 8 +- 11 files changed, 156 insertions(+), 38 deletions(-) create mode 100644 tests/fixtures/missing_directory_dependency/missing-bak/pyproject.toml create mode 100644 tests/fixtures/missing_directory_dependency_from_group/missing-bak/pyproject.toml create mode 100644 tests/fixtures/missing_directory_dependency_from_group/poetry.lock create mode 100644 tests/fixtures/missing_directory_dependency_from_group/pyproject.toml rename tests/fixtures/{missing_file_dependency => missing_file_dependency_from_group}/poetry.lock (100%) rename tests/fixtures/{missing_file_dependency => missing_file_dependency_from_group}/pyproject.toml (100%) diff --git a/tests/console/commands/test_install.py b/tests/console/commands/test_install.py index 25fdc1b81c3..2e3b34ac5b5 100644 --- a/tests/console/commands/test_install.py +++ b/tests/console/commands/test_install.py @@ -419,9 +419,10 @@ def test_install_logs_output_decorated( @pytest.mark.parametrize("options", ["", "--without dev"]) @pytest.mark.parametrize( - "project", ["missing_directory_dependency", "missing_file_dependency"] + "project", + ["missing_directory_dependency_from_group", "missing_file_dependency_from_group"], ) -def test_install_path_dependency_does_not_exist( +def test_install__dependency_does_not_exist( command_tester_factory: CommandTesterFactory, project_factory: ProjectFactory, fixture_dir: FixtureDirGetter, diff --git a/tests/console/commands/test_lock.py b/tests/console/commands/test_lock.py index 7d642722d3e..ed832eec76f 100644 --- a/tests/console/commands/test_lock.py +++ b/tests/console/commands/test_lock.py @@ -261,33 +261,6 @@ def test_lock_path_dependency_deleted_from_pyproject( assert {p.name for p in packages} == set() -@pytest.mark.parametrize("update", [True, False]) -def test_lock_missing_transitive_directory_dependency( - command_tester_factory: CommandTesterFactory, - project_factory: ProjectFactory, - fixture_dir: FixtureDirGetter, - update: bool, -) -> None: - project = "missing_transitive_directory_dependency" - poetry = _project_factory(project, project_factory, fixture_dir) - locker = Locker( - lock=poetry.pyproject.file.path.parent / "poetry.lock", - local_config=poetry.locker._local_config, - ) - poetry.set_locker(locker) - - tester = command_tester_factory("lock", poetry=poetry) - - with pytest.raises( - ValueError, - match=r"Path .*foo for foo does not exist", - ): - if update: - tester.execute("") - else: - tester.execute("--no-update") - - @pytest.mark.parametrize("is_no_update", [False, True]) def test_lock_with_incompatible_lockfile( command_tester_factory: CommandTesterFactory, diff --git a/tests/fixtures/missing_directory_dependency/missing-bak/pyproject.toml b/tests/fixtures/missing_directory_dependency/missing-bak/pyproject.toml new file mode 100644 index 00000000000..13dcdb85804 --- /dev/null +++ b/tests/fixtures/missing_directory_dependency/missing-bak/pyproject.toml @@ -0,0 +1,11 @@ +[tool.poetry] +name = "missing" +version = "1.0.0" +description = "This is a description" +authors = ["Your Name "] +license = "MIT" +packages = [] + +[tool.poetry.dependencies] +python = "*" +pendulum = "1.4.4" diff --git a/tests/fixtures/missing_directory_dependency/poetry.lock b/tests/fixtures/missing_directory_dependency/poetry.lock index 5fd7b6aeb59..663d2c6efd0 100644 --- a/tests/fixtures/missing_directory_dependency/poetry.lock +++ b/tests/fixtures/missing_directory_dependency/poetry.lock @@ -1,18 +1,110 @@ -# This file is automatically @generated by Poetry and should not be changed by hand. +# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand. [[package]] name = "missing" -version = "1.2.3" -description = "" +version = "1.0.0" +description = "This is a description" +category = "main" optional = false python-versions = "*" files = [] develop = false +[package.dependencies] +pendulum = "1.4.4" + [package.source] type = "directory" url = "missing" +[[package]] +name = "pendulum" +version = "1.4.4" +description = "Python datetimes made easy." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +files = [ + {file = "pendulum-1.4.4-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:501670f3b1d581395ec4094aff7c13dca6b699d1810cf15c446433b9e736eb4a"}, + {file = "pendulum-1.4.4-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:b9a7ef02ad6255292f35218c595f8be35e0ca3c7ac19e633ff2de96480f26ab3"}, + {file = "pendulum-1.4.4-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:3d8b280a903fb25bdba258203bbcd0533c5c04a65878f6e0700931dedd2bae72"}, + {file = "pendulum-1.4.4-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:f30fb1149e4f67b3aaa9eae874dca7bbf49788ac121d702486f5b9fe549e7920"}, + {file = "pendulum-1.4.4-cp36-cp36m-macosx_10_13_x86_64.whl", hash = "sha256:4c945ed6a3b0afab8c2f1b1e3e26bb23ad0a9be6f201604111a8217cea78e7ab"}, + {file = "pendulum-1.4.4-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:253983de6d64a01909c2524e4ab27febd0d3987d001ea6ab93a7b945fdc0e6c6"}, + {file = "pendulum-1.4.4-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:76ee830b4b57a3f8244a228505bf9c55285cc92f1a200c8578b0ca54f8185861"}, + {file = "pendulum-1.4.4.tar.gz", hash = "sha256:601e52cb0425e94b1784b6613a9085e0066ae1fa1915d18771884b67e93cac5c"}, +] + +[package.dependencies] +python-dateutil = ">=2.6.0.0,<3.0.0.0" +pytzdata = ">=2018.3.0.0" +tzlocal = ">=1.5.0.0,<2.0.0.0" + +[[package]] +name = "python-dateutil" +version = "2.8.2" +description = "Extensions to the standard Python datetime module" +category = "main" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" +files = [ + {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, + {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, +] + +[package.dependencies] +six = ">=1.5" + +[[package]] +name = "pytz" +version = "2023.3" +description = "World timezone definitions, modern and historical" +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "pytz-2023.3-py2.py3-none-any.whl", hash = "sha256:a151b3abb88eda1d4e34a9814df37de2a80e301e68ba0fd856fb9b46bfbbbffb"}, + {file = "pytz-2023.3.tar.gz", hash = "sha256:1d8ce29db189191fb55338ee6d0387d82ab59f3d00eac103412d64e0ebd0c588"}, +] + +[[package]] +name = "pytzdata" +version = "2020.1" +description = "The Olson timezone database for Python." +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +files = [ + {file = "pytzdata-2020.1-py2.py3-none-any.whl", hash = "sha256:e1e14750bcf95016381e4d472bad004eef710f2d6417240904070b3d6654485f"}, + {file = "pytzdata-2020.1.tar.gz", hash = "sha256:3efa13b335a00a8de1d345ae41ec78dd11c9f8807f522d39850f2dd828681540"}, +] + +[[package]] +name = "six" +version = "1.16.0" +description = "Python 2 and 3 compatibility utilities" +category = "main" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +files = [ + {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, + {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, +] + +[[package]] +name = "tzlocal" +version = "1.5.1" +description = "tzinfo object for the local timezone" +category = "main" +optional = false +python-versions = "*" +files = [ + {file = "tzlocal-1.5.1.tar.gz", hash = "sha256:4ebeb848845ac898da6519b9b31879cf13b6626f7184c496037b818e238f2c4e"}, +] + +[package.dependencies] +pytz = "*" + [metadata] lock-version = "2.0" python-versions = "*" diff --git a/tests/fixtures/missing_directory_dependency/pyproject.toml b/tests/fixtures/missing_directory_dependency/pyproject.toml index 570ca5debc3..15ea51277cd 100644 --- a/tests/fixtures/missing_directory_dependency/pyproject.toml +++ b/tests/fixtures/missing_directory_dependency/pyproject.toml @@ -8,6 +8,4 @@ packages = [] [tool.poetry.dependencies] python = "*" - -[tool.poetry.dev-dependencies] missing = { path = "./missing" } diff --git a/tests/fixtures/missing_directory_dependency_from_group/missing-bak/pyproject.toml b/tests/fixtures/missing_directory_dependency_from_group/missing-bak/pyproject.toml new file mode 100644 index 00000000000..b151f4f33ee --- /dev/null +++ b/tests/fixtures/missing_directory_dependency_from_group/missing-bak/pyproject.toml @@ -0,0 +1,10 @@ +[tool.poetry] +name = "missing" +version = "1.0.0" +description = "This is a description" +authors = ["Your Name "] +license = "MIT" +packages = [] + +[tool.poetry.dependencies] +python = "*" diff --git a/tests/fixtures/missing_directory_dependency_from_group/poetry.lock b/tests/fixtures/missing_directory_dependency_from_group/poetry.lock new file mode 100644 index 00000000000..5fc919161d5 --- /dev/null +++ b/tests/fixtures/missing_directory_dependency_from_group/poetry.lock @@ -0,0 +1,20 @@ +# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand. + +[[package]] +name = "missing" +version = "1.0.0" +description = "This is a description" +category = "dev" +optional = false +python-versions = "*" +files = [] +develop = false + +[package.source] +type = "directory" +url = "missing" + +[metadata] +lock-version = "2.0" +python-versions = "*" +content-hash = "d872e431c62f84f0ef176569725f19878b5a0f9d47f221d639e6df15b6c69a75" diff --git a/tests/fixtures/missing_directory_dependency_from_group/pyproject.toml b/tests/fixtures/missing_directory_dependency_from_group/pyproject.toml new file mode 100644 index 00000000000..65a6e55241e --- /dev/null +++ b/tests/fixtures/missing_directory_dependency_from_group/pyproject.toml @@ -0,0 +1,13 @@ +[tool.poetry] +name = "project-with-missing-directory-dependency-from-group" +version = "1.2.3" +description = "This is a description" +authors = ["Your Name "] +license = "MIT" +packages = [] + +[tool.poetry.dependencies] +python = "*" + +[tool.poetry.dev-dependencies] +missing = { path = "./missing" } diff --git a/tests/fixtures/missing_file_dependency/poetry.lock b/tests/fixtures/missing_file_dependency_from_group/poetry.lock similarity index 100% rename from tests/fixtures/missing_file_dependency/poetry.lock rename to tests/fixtures/missing_file_dependency_from_group/poetry.lock diff --git a/tests/fixtures/missing_file_dependency/pyproject.toml b/tests/fixtures/missing_file_dependency_from_group/pyproject.toml similarity index 100% rename from tests/fixtures/missing_file_dependency/pyproject.toml rename to tests/fixtures/missing_file_dependency_from_group/pyproject.toml diff --git a/tests/installation/test_installer.py b/tests/installation/test_installer.py index e570b969823..6ef575b6fb8 100644 --- a/tests/installation/test_installer.py +++ b/tests/installation/test_installer.py @@ -1330,16 +1330,16 @@ def test_run_installs_with_skip_directory_flag_target_does_not_exist( """ root_dir = fixture_dir("") package.root_dir = root_dir - directory = root_dir.joinpath("missing_transitive_directory_dependency") + directory = root_dir.joinpath("missing_directory_dependency") locker.set_lock_path(directory) locker.locked(locked) - dep_name = "project-with-transitive-directory-dependencies-missing" + dep_name = "project-with-missing-directory-dependency" package.add_dependency( Factory.create_dependency( dep_name, {"path": str(directory.relative_to(root_dir))}, root_dir=root_dir, - ) + ), ) repo.add_package(get_package("pendulum", "1.4.4")) @@ -1361,7 +1361,7 @@ def test_run_installs_with_skip_directory_flag_target_does_not_exist( else: with pytest.raises( ValueError, - match=r"Path .*foo for foo does not exist", + match=r"Path .*missing for missing does not exist", ): installer.run()