repo-cloner/tests/lib/cloner_test_fixtures.py
Václav Valíček c3e431bab5
Test fetch behavior
Signed-off-by: Václav Valíček <valicek1994@gmail.com>
2022-07-27 12:52:47 +02:00

53 lines
1.3 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) -> Path:
cfg_file = cloner_dir_struct.joinpath("config", "cloner.cfg")
cfg_file.touch()
cfg_file.write_text("# cloner.cfg"
"cloner_repo_url=https://git.sw3.cz/kamikaze/test-repo-base.git"
"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")