diff --git a/tests/fixtures.py b/tests/fixtures.py index eeb5a52..65c7620 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -1,5 +1,7 @@ -import os -import shutil +# import os +# import shutil +import subprocess +import tempfile from dvc.repo import Repo as DvcRepo from pytest_cases import fixture @@ -7,11 +9,12 @@ @fixture(name="dvc_repo_session", scope="session") def fix_dvc_repo_session() -> DvcRepo: - os.mkdir("./temp_test") - dvc = DvcRepo.init("./temp_test", subdir=True) - yield dvc - dvc.close() - shutil.rmtree("./temp_test") + with tempfile.TemporaryDirectory() as dir: + # os.mkdir("./temp_test") + subprocess.check_call(["git", "init"], cwd=dir) + dvc = DvcRepo.init(dir, subdir=True) + yield dvc + dvc.close() @fixture(name="dvc_repo")