import shutil from pathlib import Path import pytest from majordome.github_service import GithubConnector from majordome.settings import GithubSettings from majordome.software_repo import SoftwareRepo current_dir = Path(__file__).parent github_settings = GithubSettings() @pytest.fixture def github_token(): return github_settings.token @pytest.fixture def freetube_url(): return "https://github.com/FreeTubeApp/FreeTube" @pytest.fixture def github_connector(github_token): return GithubConnector(github_token) @pytest.fixture def freetube_tag_name_mnemonic(): return "v{{VERSION}}-beta" @pytest.fixture def freetube_amd64_deb_mnemonic(): return "freetube_{{VERSION}}_amd64.deb" @pytest.fixture def freetube_repo( freetube_url, github_connector, freetube_tag_name_mnemonic, freetube_amd64_deb_mnemonic, ): return SoftwareRepo( freetube_url, github_connector, freetube_tag_name_mnemonic, freetube_amd64_deb_mnemonic, ) @pytest.fixture def clean_tmpdir(): rm_tmpdir() yield rm_tmpdir() def rm_tmpdir(): print("teardown") tmp_dir = current_dir / "tmp" if tmp_dir.exists(): shutil.rmtree(tmp_dir)