Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/test_batch_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
from cadetrdm.io_utils import delete_path


@pytest.fixture(autouse=True)
def isolated_cwd(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)


@pytest.mark.server_api
def test_module_import():
WORK_DIR = Path.cwd() / "tmp"
Expand Down
5 changes: 5 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
runner = CliRunner()


@pytest.fixture(autouse=True)
def isolated_cwd(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)


def create_repo():
if os.path.exists("test_repo_cli"):
delete_path("test_repo_cli")
Expand Down
9 changes: 7 additions & 2 deletions tests/test_git_adapter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import random
import uuid
from pathlib import Path

import git
Expand All @@ -14,6 +14,11 @@
from cadetrdm.wrapper import tracks_results


@pytest.fixture(autouse=True)
def isolated_cwd(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)


@pytest.fixture(scope="module")
def path_to_repo():
# a "fixture" serves up shared, ready variables to test functions that should use the fixture as a kwarg
Expand All @@ -22,7 +27,7 @@ def path_to_repo():

def modify_code(path_to_repo):
# Add changes to the project code
random_number = random.randint(0, 265)
random_number = uuid.uuid4().int
filepath = path_to_repo / f"print_random_number.py"
with open(filepath, "w") as file:
file.write(f"print({random_number})\n")
Expand Down
5 changes: 5 additions & 0 deletions tests/test_gitlab_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
from cadetrdm.repositories import BaseRepo


@pytest.fixture(autouse=True)
def isolated_cwd(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)


@pytest.mark.server_api
def test_gitlab_create():
url = "https://jugit.fz-juelich.de/"
Expand Down
Loading