Skip to content

Commit 90e1c48

Browse files
Panaetiusjsam
authored andcommitted
fix: renku home directory overwrite in tests (#657)
1 parent fdd7215 commit 90e1c48

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

conftest.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@ def runner(monkeypatch):
5555
return CliRunner()
5656

5757

58+
@pytest.fixture
59+
def config_dir(monkeypatch, tmpdir_factory):
60+
"""Create a temporary renku config directory."""
61+
from renku.api.config import ConfigManagerMixin
62+
63+
with monkeypatch.context() as m:
64+
home_dir = tmpdir_factory.mktemp('fake_home')
65+
conf_path = home_dir / 'renku.ini'
66+
m.setattr(ConfigManagerMixin, 'config_path', conf_path)
67+
68+
yield m
69+
70+
5871
@pytest.fixture()
5972
def run_shell():
6073
"""Create a shell cmd runner."""

tests/test_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ def test_outputs(runner, project):
764764
@pytest.mark.skipif(
765765
shutil.which('docker') is None, reason='requires docker command line'
766766
)
767-
def test_image_pull(runner, project):
767+
def test_image_pull(runner, project, config_dir):
768768
"""Test image pulling."""
769769
cmd = ['image', 'pull']
770770
result = runner.invoke(cli.cli, cmd)
@@ -952,7 +952,7 @@ def test_config_load_get_value(client):
952952
assert 'zenodo' not in config.sections()
953953

954954

955-
def test_config_manager_cli(client, runner, project):
955+
def test_config_manager_cli(client, runner, project, config_dir):
956956
"""Check config command for global cfg."""
957957
result = runner.invoke(
958958
cli.cli, [

0 commit comments

Comments
 (0)