Skip to content

Commit

Permalink
fix: revise tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban committed Sep 13, 2024
1 parent 659820c commit 10fcecd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion templateflow/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _env_to_bool(envvar: str, default: bool) -> bool:


TF_DEFAULT_HOME = Path.home() / '.cache' / 'templateflow'
TF_HOME = Path(getenv('TEMPLATEFLOW_HOME', str(TF_DEFAULT_HOME)))
TF_HOME = Path(getenv('TEMPLATEFLOW_HOME', str(TF_DEFAULT_HOME))).absolute()
TF_GITHUB_SOURCE = 'https://github.com/templateflow/templateflow.git'
TF_S3_ROOT = 'https://templateflow.s3.amazonaws.com'
TF_USE_DATALAD = _env_to_bool('TEMPLATEFLOW_USE_DATALAD', False)
Expand Down
6 changes: 5 additions & 1 deletion templateflow/conf/tests/test_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,16 @@ def test_conf_init(monkeypatch, tmp_path, use_datalad):
@pytest.mark.parametrize('use_datalad', ['off', 'on'])
def test_setup_home(monkeypatch, tmp_path, capfd, use_datalad):
"""Check the correct functioning of the installation hook."""
home = (tmp_path / f'setup-home-{use_datalad}').resolve()
home = (tmp_path / f'setup-home-{use_datalad}').absolute()
monkeypatch.setenv('TEMPLATEFLOW_USE_DATALAD', use_datalad)
monkeypatch.setenv('TEMPLATEFLOW_HOME', str(home))

with capfd.disabled():
reload(tfc)

# Ensure mocks are up-to-date
assert tfc.TF_USE_DATALAD is (use_datalad == 'on')
assert str(tfc.TF_HOME) == str(home)
# First execution, the S3 stub is created (or datalad install)
assert tfc.TF_CACHED is False
assert tfc.setup_home() is False
Expand Down

0 comments on commit 10fcecd

Please sign in to comment.