From 9ad58c4684d9d895adc4e8af560d803d53d32894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Al=C3=A1n=20Mu=C3=B1oz?= <alan.munoz@ed.ac.uk> Date: Sat, 24 Sep 2022 17:15:51 +0100 Subject: [PATCH] fix(tests): add data folder --- .gitignore | 1 - tests/agora/base_test.py | 2 +- tests/agora/conftest.py | 15 ++++++++++----- tests/agora/data/parameters.yaml | 1 + 4 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 tests/agora/data/parameters.yaml diff --git a/.gitignore b/.gitignore index 3bc76765..a70a62ab 100644 --- a/.gitignore +++ b/.gitignore @@ -110,7 +110,6 @@ venv.bak/ omero_py/omeroweb/ omero_py/pipeline/ **.ipynb -data/ notebooks/ *.pdf *.h5 diff --git a/tests/agora/base_test.py b/tests/agora/base_test.py index feefb908..feb333b9 100644 --- a/tests/agora/base_test.py +++ b/tests/agora/base_test.py @@ -44,7 +44,7 @@ def test_to_yaml(yaml_file): def test_dict(example_dict): params = DummyParameters(**example_dict) - assert params.to_dict() == param_dict + assert params.to_dict() == example_dict # Remove params.to_yaml("outfile.yml") diff --git a/tests/agora/conftest.py b/tests/agora/conftest.py index 6804b892..7125dc5e 100644 --- a/tests/agora/conftest.py +++ b/tests/agora/conftest.py @@ -3,24 +3,29 @@ Load data necessary to test agora. """ import typing as t -from pathlib import Path +from pathlib import Path, PosixPath import pytest @pytest.fixture(scope="module") -def yaml_file(): - return Path(__file__).parent / "data/parameters.yaml" +def data_dir(): + return Path(__file__).parent / "data" + + +@pytest.fixture(scope="module") +def yaml_file(data_dir: PosixPath): + return data_dir / "parameters.yaml" @pytest.fixture(scope="module", autouse=True) -def parameters_example() -> t.Dict: +def example_dict() -> t.Dict: return dict( string="abc", number=1, boolean=True, dictionary=dict( - empty_dict=dict(), + # empty_dict=dict(), string="def", number=2, ), diff --git a/tests/agora/data/parameters.yaml b/tests/agora/data/parameters.yaml new file mode 100644 index 00000000..0967ef42 --- /dev/null +++ b/tests/agora/data/parameters.yaml @@ -0,0 +1 @@ +{} -- GitLab