repo-cloner/tests/lib/cloner_test_fixtures.py
Václav Valíček b1b0554e60
Cloner begining
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
2022-07-28 21:03:20 +02:00

54 lines
1.4 KiB
Python

import pytest
from pathlib import Path
@pytest.fixture
def support_data_path() -> Path:
path = Path(__file__).parent.parent.joinpath("_support_data")
return path
@pytest.fixture
def cloner_dir_struct(tmp_path: Path) -> Path:
tmp_path.joinpath("config").mkdir()
tmp_path.joinpath("cache").mkdir()
tmp_path.joinpath("repos").mkdir()
return tmp_path
@pytest.fixture
def cloner_dir_with_config(cloner_dir_struct: Path, support_data_path) -> Path:
repo_source = support_data_path.joinpath("test-repo-base").as_uri()
cfg_file = cloner_dir_struct.joinpath("config", "cloner.cfg")
cfg_file.touch()
cfg_file.write_text(f"# cloner.cfg"
f"cloner_repo_url={repo_source}"
"cloner_project_name=test-repo"
)
return cloner_dir_struct
@pytest.fixture
def path_repo_base(support_data_path: Path) -> Path:
return support_data_path.joinpath("test-repo-base")
@pytest.fixture
def path_repo_different_tags(support_data_path: Path) -> Path:
return support_data_path.joinpath("test-repo-different-tags")
@pytest.fixture
def path_repo_changed_branches(support_data_path: Path) -> Path:
return support_data_path.joinpath("test-repo-changed-branches")
@pytest.fixture
def path_repo_new_commits(support_data_path: Path) -> Path:
return support_data_path.joinpath("test-repo-new-commits")
@pytest.fixture
def path_repo_reduced(support_data_path: Path) -> Path:
return support_data_path.joinpath("test-repo-reduced")