Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 15 additions & 20 deletions tests/test_exporter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any

Expand Down Expand Up @@ -36,15 +35,17 @@


if TYPE_CHECKING:
from pathlib import Path

from packaging.utils import NormalizedName
from poetry.poetry import Poetry

from tests.conftest import Config


class Locker(BaseLocker):
def __init__(self) -> None:
self._lock = TOMLFile(Path.cwd().joinpath("poetry.lock"))
def __init__(self, fixture_root: Path) -> None:
self._lock = TOMLFile(fixture_root / "poetry.lock")
self._locked = True
self._content_hash = self._get_content_hash()

Expand All @@ -66,9 +67,9 @@ def _get_content_hash(self) -> str:
return "123456789"


@pytest.fixture()
def locker() -> Locker:
return Locker()
@pytest.fixture
def locker(fixture_root: Path) -> Locker:
return Locker(fixture_root)


@pytest.fixture
Expand Down Expand Up @@ -1260,7 +1261,7 @@ def test_exporter_can_export_requirements_txt_with_directory_packages(
"python-versions": "*",
"source": {
"type": "directory",
"url": "tests/fixtures/sample_project",
"url": "sample_project",
"reference": "",
},
}
Expand Down Expand Up @@ -1301,7 +1302,7 @@ def test_exporter_can_export_requirements_txt_with_nested_directory_packages(
"python-versions": "*",
"source": {
"type": "directory",
"url": "tests/fixtures/sample_project",
"url": "sample_project",
"reference": "",
},
},
Expand All @@ -1313,10 +1314,7 @@ def test_exporter_can_export_requirements_txt_with_nested_directory_packages(
"python-versions": "*",
"source": {
"type": "directory",
"url": (
"tests/fixtures/sample_project/"
"../project_with_nested_local/bar"
),
"url": "sample_project/../project_with_nested_local/bar",
"reference": "",
},
},
Expand All @@ -1328,10 +1326,7 @@ def test_exporter_can_export_requirements_txt_with_nested_directory_packages(
"python-versions": "*",
"source": {
"type": "directory",
"url": (
"tests/fixtures/sample_project/"
"../project_with_nested_local/bar/.."
),
"url": "sample_project/../project_with_nested_local/bar/..",
"reference": "",
},
},
Expand Down Expand Up @@ -1375,7 +1370,7 @@ def test_exporter_can_export_requirements_txt_with_directory_packages_and_marker
"marker": "python_version < '3.7'",
"source": {
"type": "directory",
"url": "tests/fixtures/sample_project",
"url": "sample_project",
"reference": "",
},
}
Expand Down Expand Up @@ -1417,7 +1412,7 @@ def test_exporter_can_export_requirements_txt_with_file_packages(
"python-versions": "*",
"source": {
"type": "file",
"url": "tests/fixtures/distributions/demo-0.1.0.tar.gz",
"url": "distributions/demo-0.1.0.tar.gz",
"reference": "",
},
}
Expand Down Expand Up @@ -1460,7 +1455,7 @@ def test_exporter_can_export_requirements_txt_with_file_packages_and_markers(
"marker": "python_version < '3.7'",
"source": {
"type": "file",
"url": "tests/fixtures/distributions/demo-0.1.0.tar.gz",
"url": "distributions/demo-0.1.0.tar.gz",
"reference": "",
},
}
Expand Down Expand Up @@ -2573,7 +2568,7 @@ def test_exporter_raises_exception_for_constraints_txt_with_editable_packages(
"python-versions": "*",
"source": {
"type": "directory",
"url": "tests/fixtures/sample_project",
"url": "sample_project",
"reference": "",
},
"develop": True,
Expand Down