Commit 3855bc58 by Randy Döring

tests: consistently use fixture_dir

parent 4c377351
......@@ -282,6 +282,11 @@ def http() -> Iterator[type[httpretty.httpretty]]:
yield httpretty
@pytest.fixture
def project_root() -> Path:
return Path(__file__).parent.parent
@pytest.fixture(scope="session")
def fixture_base() -> Path:
return Path(__file__).parent / "fixtures"
......@@ -417,11 +422,6 @@ def project_factory(
return _factory
@pytest.fixture
def project_root() -> Path:
return Path(__file__).parent.parent
@pytest.fixture(autouse=True)
def set_simple_log_formatter() -> None:
"""
......
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
......@@ -20,12 +19,11 @@ if TYPE_CHECKING:
from tests.helpers import TestRepository
from tests.types import CommandTesterFactory
from tests.types import FixtureDirGetter
FIXTURES = Path(__file__).parent.joinpath("fixtures")
@pytest.fixture()
def setup(mocker: MockerFixture, fixture_dir: Path):
@pytest.fixture
def setup(mocker: MockerFixture, fixture_dir: FixtureDirGetter) -> None:
mocker.patch.object(
Executor,
"_download",
......@@ -46,7 +44,7 @@ def test_self_update_can_update_from_recommended_installation(
tester: CommandTester,
repo: TestRepository,
installed: TestRepository,
):
) -> None:
new_version = Version.parse(__version__).next_minor().text
old_poetry = Package("poetry", __version__)
......
......@@ -3,23 +3,26 @@ from __future__ import annotations
import shutil
import tarfile
from pathlib import Path
from typing import TYPE_CHECKING
from poetry.factory import Factory
if TYPE_CHECKING:
from pathlib import Path
from poetry.utils.env import VirtualEnv
from tests.types import CommandTesterFactory
from tests.types import FixtureDirGetter
def test_build_with_multiple_readme_files(
tmp_path: Path, tmp_venv: VirtualEnv, command_tester_factory: CommandTesterFactory
):
source_dir = (
Path(__file__).parent.parent.parent / "fixtures" / "with_multiple_readme_files"
)
fixture_dir: FixtureDirGetter,
tmp_path: Path,
tmp_venv: VirtualEnv,
command_tester_factory: CommandTesterFactory,
) -> None:
source_dir = fixture_dir("with_multiple_readme_files")
target_dir = tmp_path / "project"
shutil.copytree(str(source_dir), str(target_dir))
......
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
......@@ -11,6 +10,7 @@ if TYPE_CHECKING:
from pytest_mock import MockerFixture
from tests.types import CommandTesterFactory
from tests.types import FixtureDirGetter
@pytest.fixture()
......@@ -18,7 +18,7 @@ def tester(command_tester_factory: CommandTesterFactory) -> CommandTester:
return command_tester_factory("check")
def test_check_valid(tester: CommandTester):
def test_check_valid(tester: CommandTester) -> None:
tester.execute()
expected = """\
......@@ -28,17 +28,14 @@ All set!
assert tester.io.fetch_output() == expected
def test_check_invalid(mocker: MockerFixture, tester: CommandTester):
def test_check_invalid(
mocker: MockerFixture, tester: CommandTester, fixture_dir: FixtureDirGetter
) -> None:
from poetry.toml import TOMLFile
mocker.patch(
"poetry.poetry.Poetry.file",
return_value=TOMLFile(
Path(__file__).parent.parent.parent
/ "fixtures"
/ "invalid_pyproject"
/ "pyproject.toml"
),
return_value=TOMLFile(fixture_dir("invalid_pyproject") / "pyproject.toml"),
new_callable=mocker.PropertyMock,
)
......@@ -61,13 +58,12 @@ Warning: Deprecated classifier\
assert tester.io.fetch_error() == expected
def test_check_private(mocker: MockerFixture, tester: CommandTester):
def test_check_private(
mocker: MockerFixture, tester: CommandTester, fixture_dir: FixtureDirGetter
) -> None:
mocker.patch(
"poetry.factory.Factory.locate",
return_value=Path(__file__).parent.parent.parent
/ "fixtures"
/ "private_pyproject"
/ "pyproject.toml",
return_value=fixture_dir("private_pyproject") / "pyproject.toml",
)
tester.execute()
......
......@@ -2,7 +2,6 @@ from __future__ import annotations
import os
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
......@@ -22,6 +21,7 @@ from tests.helpers import mock_clone
if TYPE_CHECKING:
from collections.abc import Iterator
from pathlib import Path
from pytest_mock import MockerFixture
......@@ -31,6 +31,7 @@ if TYPE_CHECKING:
from poetry.utils.env import Env
from tests.conftest import Config
from tests.types import CommandTesterFactory
from tests.types import FixtureDirGetter
from tests.types import ProjectFactory
......@@ -96,11 +97,12 @@ def project_directory() -> str:
@pytest.fixture
def poetry(project_directory: str, project_factory: ProjectFactory) -> Poetry:
return project_factory(
name="simple",
source=Path(__file__).parent.parent / "fixtures" / project_directory,
)
def poetry(
project_directory: str,
project_factory: ProjectFactory,
fixture_dir: FixtureDirGetter,
) -> Poetry:
return project_factory(name="simple", source=fixture_dir(project_directory))
@pytest.fixture
......
......@@ -68,13 +68,6 @@ def get_dependency(
return Factory.create_dependency(name, constraint or "*", groups=groups)
def fixture(path: str | None = None) -> Path:
if path:
return FIXTURE_PATH / path
else:
return FIXTURE_PATH
def copy_or_symlink(source: Path, dest: Path) -> None:
if dest.is_symlink() or dest.is_file():
dest.unlink() # missing_ok is only available in Python >= 3.8
......@@ -113,7 +106,7 @@ def mock_clone(
parsed = ParsedUrl.parse(url)
path = re.sub(r"(.git)?$", "", parsed.pathname.lstrip("/"))
folder = Path(__file__).parent / "fixtures" / "git" / parsed.resource / path
folder = FIXTURE_PATH / "git" / parsed.resource / path
if not source_root:
source_root = Path(Config.create().get("cache-dir")) / "src"
......@@ -128,8 +121,7 @@ def mock_clone(
def mock_download(url: str, dest: Path) -> None:
parts = urllib.parse.urlparse(url)
fixtures = Path(__file__).parent / "fixtures"
fixture = fixtures / parts.path.lstrip("/")
fixture = FIXTURE_PATH / parts.path.lstrip("/")
copy_or_symlink(fixture, dest)
......
from __future__ import annotations
from pathlib import Path
from subprocess import CalledProcessError
from typing import TYPE_CHECKING
......@@ -13,10 +12,11 @@ from poetry.utils.env import VirtualEnv
if TYPE_CHECKING:
from pathlib import Path
from pytest_mock import MockerFixture
FIXTURE_DIR_BASE = Path(__file__).parent.parent / "fixtures"
FIXTURE_DIR_INSPECTIONS = FIXTURE_DIR_BASE / "inspection"
from tests.types import FixtureDirGetter
@pytest.fixture(autouse=True)
......@@ -25,13 +25,13 @@ def pep517_metadata_mock() -> None:
@pytest.fixture
def demo_sdist() -> Path:
return FIXTURE_DIR_BASE / "distributions" / "demo-0.1.0.tar.gz"
def demo_sdist(fixture_dir: FixtureDirGetter) -> Path:
return fixture_dir("distributions") / "demo-0.1.0.tar.gz"
@pytest.fixture
def demo_wheel() -> Path:
return FIXTURE_DIR_BASE / "distributions" / "demo-0.1.0-py2.py3-none-any.whl"
def demo_wheel(fixture_dir: FixtureDirGetter) -> Path:
return fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl"
@pytest.fixture
......@@ -128,15 +128,15 @@ def test_info_from_bdist(demo_wheel: Path) -> None:
demo_check_info(info)
def test_info_from_poetry_directory() -> None:
def test_info_from_poetry_directory(fixture_dir: FixtureDirGetter) -> None:
info = PackageInfo.from_directory(
FIXTURE_DIR_INSPECTIONS / "demo", disable_build=True
fixture_dir("inspection") / "demo", disable_build=True
)
demo_check_info(info)
def test_info_from_poetry_directory_fallback_on_poetry_create_error(
mocker: MockerFixture,
mocker: MockerFixture, fixture_dir: FixtureDirGetter
) -> None:
mock_create_poetry = mocker.patch(
"poetry.inspection.info.Factory.create_poetry", side_effect=RuntimeError
......@@ -146,16 +146,16 @@ def test_info_from_poetry_directory_fallback_on_poetry_create_error(
"poetry.inspection.info.get_pep517_metadata"
)
PackageInfo.from_directory(FIXTURE_DIR_INSPECTIONS / "demo_poetry_package")
PackageInfo.from_directory(fixture_dir("inspection") / "demo_poetry_package")
assert mock_create_poetry.call_count == 1
assert mock_get_poetry_package.call_count == 1
assert mock_get_pep517_metadata.call_count == 1
def test_info_from_requires_txt() -> None:
def test_info_from_requires_txt(fixture_dir: FixtureDirGetter) -> None:
info = PackageInfo.from_metadata(
FIXTURE_DIR_INSPECTIONS / "demo_only_requires_txt.egg-info"
fixture_dir("inspection") / "demo_only_requires_txt.egg-info"
)
assert info is not None
demo_check_info(info)
......@@ -171,9 +171,9 @@ def test_info_from_setup_cfg(demo_setup_cfg: Path) -> None:
demo_check_info(info, requires_dist={"package"})
def test_info_no_setup_pkg_info_no_deps() -> None:
def test_info_no_setup_pkg_info_no_deps(fixture_dir: FixtureDirGetter) -> None:
info = PackageInfo.from_directory(
FIXTURE_DIR_INSPECTIONS / "demo_no_setup_pkg_info_no_deps",
fixture_dir("inspection") / "demo_no_setup_pkg_info_no_deps",
disable_build=True,
)
assert info.name == "demo"
......@@ -250,8 +250,8 @@ def test_info_setup_missing_mandatory_should_trigger_pep517(
assert spy.call_count == 1
def test_info_prefer_poetry_config_over_egg_info() -> None:
def test_info_prefer_poetry_config_over_egg_info(fixture_dir: FixtureDirGetter) -> None:
info = PackageInfo.from_directory(
FIXTURE_DIR_INSPECTIONS / "demo_with_obsolete_egg_info"
fixture_dir("inspection") / "demo_with_obsolete_egg_info"
)
demo_check_info(info)
......@@ -24,6 +24,7 @@ if TYPE_CHECKING:
from poetry.utils.env import VirtualEnv
from tests.conftest import Config
from tests.types import FixtureDirGetter
@pytest.fixture
......@@ -278,7 +279,10 @@ def test_install_with_trusted_host(config: Config, env: NullEnv) -> None:
def test_install_directory_fallback_on_poetry_create_error(
mocker: MockerFixture, tmp_venv: VirtualEnv, pool: RepositoryPool
mocker: MockerFixture,
tmp_venv: VirtualEnv,
pool: RepositoryPool,
fixture_dir: FixtureDirGetter,
) -> None:
mock_create_poetry = mocker.patch(
"poetry.factory.Factory.create_poetry", side_effect=RuntimeError
......@@ -293,9 +297,7 @@ def test_install_directory_fallback_on_poetry_create_error(
"demo",
"1.0.0",
source_type="directory",
source_url=str(
Path(__file__).parent.parent / "fixtures/inspection/demo_poetry_package"
),
source_url=str(fixture_dir("inspection") / "demo_poetry_package"),
)
installer = PipInstaller(tmp_venv, NullIO(), pool)
......
......@@ -28,51 +28,40 @@ if TYPE_CHECKING:
from pytest_mock import MockerFixture
from poetry.poetry import Poetry
from tests.types import FixtureDirGetter
@pytest.fixture()
def simple_poetry() -> Poetry:
poetry = Factory().create_poetry(
Path(__file__).parent.parent.parent / "fixtures" / "simple_project"
)
def simple_poetry(fixture_dir: FixtureDirGetter) -> Poetry:
poetry = Factory().create_poetry(fixture_dir("simple_project"))
return poetry
@pytest.fixture()
def project_with_include() -> Poetry:
poetry = Factory().create_poetry(
Path(__file__).parent.parent.parent / "fixtures" / "with-include"
)
def project_with_include(fixture_dir: FixtureDirGetter) -> Poetry:
poetry = Factory().create_poetry(fixture_dir("with-include"))
return poetry
@pytest.fixture()
def extended_poetry() -> Poetry:
poetry = Factory().create_poetry(
Path(__file__).parent.parent.parent / "fixtures" / "extended_project"
)
def extended_poetry(fixture_dir: FixtureDirGetter) -> Poetry:
poetry = Factory().create_poetry(fixture_dir("extended_project"))
return poetry
@pytest.fixture()
def extended_without_setup_poetry() -> Poetry:
poetry = Factory().create_poetry(
Path(__file__).parent.parent.parent
/ "fixtures"
/ "extended_project_without_setup"
)
def extended_without_setup_poetry(fixture_dir: FixtureDirGetter) -> Poetry:
poetry = Factory().create_poetry(fixture_dir("extended_project_without_setup"))
return poetry
@pytest.fixture
def with_multiple_readme_files() -> Poetry:
poetry = Factory().create_poetry(
Path(__file__).parent.parent.parent / "fixtures" / "with_multiple_readme_files"
)
def with_multiple_readme_files(fixture_dir: FixtureDirGetter) -> Poetry:
poetry = Factory().create_poetry(fixture_dir("with_multiple_readme_files"))
return poetry
......@@ -235,9 +224,11 @@ def test_builder_falls_back_on_setup_and_pip_for_packages_with_build_scripts(
assert [] == env.executed
def test_builder_setup_generation_runs_with_pip_editable(tmp_path: Path) -> None:
def test_builder_setup_generation_runs_with_pip_editable(
fixture_dir: FixtureDirGetter, tmp_path: Path
) -> None:
# create an isolated copy of the project
fixture = Path(__file__).parent.parent.parent / "fixtures" / "extended_project"
fixture = fixture_dir("extended_project")
extended_project = tmp_path / "extended_project"
shutil.copytree(fixture, extended_project)
......
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
from poetry.factory import Factory
......@@ -13,6 +12,7 @@ if TYPE_CHECKING:
from poetry.repositories import Repository
from tests.mixology.version_solver.conftest import Provider
from tests.types import FixtureDirGetter
def test_no_version_matching_constraint(
......@@ -94,11 +94,13 @@ Because myapp depends on both foo (1.0.0) and foo (2.0.0), version solving faile
def test_disjoint_root_constraints_path_dependencies(
root: ProjectPackage, provider: Provider, repo: Repository
root: ProjectPackage,
provider: Provider,
repo: Repository,
fixture_dir: FixtureDirGetter,
) -> None:
provider.set_package_python_versions("^3.7")
fixtures = Path(__file__).parent.parent.parent / "fixtures"
project_dir = fixtures.joinpath("with_conditional_path_deps")
project_dir = fixture_dir("with_conditional_path_deps")
dependency1 = Factory.create_dependency("demo", {"path": project_dir / "demo_one"})
root.add_dependency(dependency1)
dependency2 = Factory.create_dependency("demo", {"path": project_dir / "demo_two"})
......
......@@ -737,14 +737,13 @@ content-hash = "c3d07fca33fba542ef2b2a4d75bf5b48d892d21a830e2ad9c952ba5123a52f77
def test_root_extras_dependencies_are_ordered(
locker: Locker, root: ProjectPackage
locker: Locker, root: ProjectPackage, fixture_base: Path
) -> None:
root_dir = Path(__file__).parent.parent.joinpath("fixtures")
Factory.create_dependency("B", "1.0.0", root_dir=root_dir)
Factory.create_dependency("C", "1.0.0", root_dir=root_dir)
package_first = Factory.create_dependency("first", "1.0.0", root_dir=root_dir)
package_second = Factory.create_dependency("second", "1.0.0", root_dir=root_dir)
package_third = Factory.create_dependency("third", "1.0.0", root_dir=root_dir)
Factory.create_dependency("B", "1.0.0", root_dir=fixture_base)
Factory.create_dependency("C", "1.0.0", root_dir=fixture_base)
package_first = Factory.create_dependency("first", "1.0.0", root_dir=fixture_base)
package_second = Factory.create_dependency("second", "1.0.0", root_dir=fixture_base)
package_third = Factory.create_dependency("third", "1.0.0", root_dir=fixture_base)
root.extras = {
"C": [package_third, package_second, package_first],
......@@ -834,25 +833,24 @@ content-hash = "c3d07fca33fba542ef2b2a4d75bf5b48d892d21a830e2ad9c952ba5123a52f77
def test_locker_dumps_dependency_information_correctly(
locker: Locker, root: ProjectPackage
locker: Locker, root: ProjectPackage, fixture_base: Path
) -> None:
root_dir = Path(__file__).parent.parent.joinpath("fixtures")
package_a = get_package("A", "1.0.0")
package_a.add_dependency(
Factory.create_dependency(
"B", {"path": "project_with_extras", "develop": True}, root_dir=root_dir
"B", {"path": "project_with_extras", "develop": True}, root_dir=fixture_base
)
)
package_a.add_dependency(
Factory.create_dependency(
"C",
{"path": "directory/project_with_transitive_directory_dependencies"},
root_dir=root_dir,
root_dir=fixture_base,
)
)
package_a.add_dependency(
Factory.create_dependency(
"D", {"path": "distributions/demo-0.1.0.tar.gz"}, root_dir=root_dir
"D", {"path": "distributions/demo-0.1.0.tar.gz"}, root_dir=fixture_base
)
)
package_a.add_dependency(
......@@ -969,15 +967,14 @@ content-hash = "115cf985d932e9bf5f540555bbdd75decbb62cac81e399375fc19f6277f8c1d8
def test_locker_dumps_dependency_extras_in_correct_order(
locker: Locker, root: ProjectPackage
locker: Locker, root: ProjectPackage, fixture_base: Path
) -> None:
root_dir = Path(__file__).parent.parent.joinpath("fixtures")
package_a = get_package("A", "1.0.0")
Factory.create_dependency("B", "1.0.0", root_dir=root_dir)
Factory.create_dependency("C", "1.0.0", root_dir=root_dir)
package_first = Factory.create_dependency("first", "1.0.0", root_dir=root_dir)
package_second = Factory.create_dependency("second", "1.0.0", root_dir=root_dir)
package_third = Factory.create_dependency("third", "1.0.0", root_dir=root_dir)
Factory.create_dependency("B", "1.0.0", root_dir=fixture_base)
Factory.create_dependency("C", "1.0.0", root_dir=fixture_base)
package_first = Factory.create_dependency("first", "1.0.0", root_dir=fixture_base)
package_second = Factory.create_dependency("second", "1.0.0", root_dir=fixture_base)
package_third = Factory.create_dependency("third", "1.0.0", root_dir=fixture_base)
package_a.extras = {
"C": [package_third, package_second, package_first],
......
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
......@@ -21,8 +20,7 @@ if TYPE_CHECKING:
from pytest_mock import MockerFixture
from tests.conftest import Config
CWD = Path(__file__).parent.parent / "fixtures" / "simple_project"
from tests.types import FixtureDirGetter
class ManagerFactory(Protocol):
......@@ -46,13 +44,14 @@ class InvalidPlugin:
poetry.package.version = "9.9.9"
@pytest.fixture()
def poetry(tmp_path: Path, config: Config) -> Poetry:
@pytest.fixture
def poetry(fixture_dir: FixtureDirGetter, config: Config) -> Poetry:
project_path = fixture_dir("simple_project")
poetry = Poetry(
CWD / "pyproject.toml",
project_path / "pyproject.toml",
{},
ProjectPackage("simple-project", "1.2.3"),
Locker(CWD / "poetry.lock", {}),
Locker(project_path / "poetry.lock", {}),
config,
)
......@@ -82,7 +81,7 @@ def test_load_plugins_and_activate(
poetry: Poetry,
io: BufferedIO,
with_my_plugin: None,
):
) -> None:
manager = manager_factory()
manager.load_plugins()
manager.activate(poetry, io)
......@@ -106,7 +105,7 @@ def test_load_plugins_with_invalid_plugin(
poetry: Poetry,
io: BufferedIO,
with_invalid_plugin: None,
):
) -> None:
manager = manager_factory()
with pytest.raises(ValueError):
......@@ -118,7 +117,7 @@ def test_load_plugins_with_plugins_disabled(
poetry: Poetry,
io: BufferedIO,
with_my_plugin: None,
):
) -> None:
no_plugin_manager.load_plugins()
assert poetry.package.version.text == "1.2.3"
......
......@@ -42,6 +42,7 @@ if TYPE_CHECKING:
from poetry.poetry import Poetry
from tests.conftest import Config
from tests.types import FixtureDirGetter
from tests.types import ProjectFactory
MINIMAL_SCRIPT = """\
......@@ -77,9 +78,8 @@ class MockVirtualEnv(VirtualEnv):
@pytest.fixture()
def poetry(project_factory: ProjectFactory) -> Poetry:
fixture = Path(__file__).parent.parent / "fixtures" / "simple_project"
return project_factory("simple", source=fixture)
def poetry(project_factory: ProjectFactory, fixture_dir: FixtureDirGetter) -> Poetry:
return project_factory("simple", source=fixture_dir("simple_project"))
@pytest.fixture()
......@@ -100,7 +100,7 @@ def test_virtualenvs_with_spaces_in_their_path_work_as_expected(
@pytest.mark.skipif(sys.platform != "darwin", reason="requires darwin")
def test_venv_backup_exclusion(tmp_path: Path, manager: EnvManager):
def test_venv_backup_exclusion(tmp_path: Path, manager: EnvManager) -> None:
import xattr
venv_path = tmp_path / "Virtual Env"
......@@ -1042,7 +1042,7 @@ def test_check_output_with_called_process_error(
@pytest.mark.parametrize("out", ["sys.stdout", "sys.stderr"])
def test_call_does_not_block_on_full_pipe(
tmp_path: Path, tmp_venv: VirtualEnv, out: str
):
) -> None:
"""see https://github.com/python-poetry/poetry/issues/7698"""
script = tmp_path / "script.py"
script.write_text(
......@@ -1664,10 +1664,8 @@ def test_generate_env_name_uses_real_path(
@pytest.fixture()
def extended_without_setup_poetry() -> Poetry:
poetry = Factory().create_poetry(
Path(__file__).parent.parent / "fixtures" / "extended_project_without_setup"
)
def extended_without_setup_poetry(fixture_dir: FixtureDirGetter) -> Poetry:
poetry = Factory().create_poetry(fixture_dir("extended_project_without_setup"))
return poetry
......@@ -1713,6 +1711,7 @@ def test_build_environment_not_called_without_build_script_specified(
def test_create_venv_project_name_empty_sets_correct_prompt(
fixture_dir: FixtureDirGetter,
project_factory: ProjectFactory,
config: Config,
mocker: MockerFixture,
......@@ -1721,8 +1720,7 @@ def test_create_venv_project_name_empty_sets_correct_prompt(
if "VIRTUAL_ENV" in os.environ:
del os.environ["VIRTUAL_ENV"]
fixture = Path(__file__).parent.parent / "fixtures" / "no_name_project"
poetry = project_factory("no", source=fixture)
poetry = project_factory("no", source=fixture_dir("no_name_project"))
manager = EnvManager(poetry)
poetry.package.python_versions = "^3.7"
......
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
import pytest
......@@ -14,7 +13,7 @@ if TYPE_CHECKING:
from tests.types import FixtureDirGetter
def test_parse_requires():
def test_parse_requires() -> None:
requires = """\
jsonschema>=2.6.0.0,<3.0.0.0
lockfile>=0.12.0.0,<0.13.0.0
......@@ -71,10 +70,8 @@ isort@ git+git://github.com/timothycrosley/isort.git@e63ae06ec7d70b06df9e5283576
def test_default_hash(fixture_dir: FixtureDirGetter) -> None:
root_dir = Path(__file__).parent.parent.parent
file_path = root_dir / fixture_dir("distributions/demo-0.1.0.tar.gz")
sha_256 = "9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad"
assert get_file_hash(file_path) == sha_256
assert get_file_hash(fixture_dir("distributions") / "demo-0.1.0.tar.gz") == sha_256
try:
......@@ -130,6 +127,5 @@ except ImportError:
def test_guaranteed_hash(
hash_name: str, expected: str, fixture_dir: FixtureDirGetter
) -> None:
root_dir = Path(__file__).parent.parent.parent
file_path = root_dir / fixture_dir("distributions/demo-0.1.0.tar.gz")
file_path = fixture_dir("distributions") / "demo-0.1.0.tar.gz"
assert get_file_hash(file_path, hash_name) == expected
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