diff --git a/src/biocommons/example/tests/conftest.py b/src/biocommons/example/tests/conftest.py new file mode 100644 index 0000000..31f4c0f --- /dev/null +++ b/src/biocommons/example/tests/conftest.py @@ -0,0 +1,10 @@ +import importlib + +import pytest +import yaml + + +@pytest.fixture +def all_quotes(): + quotes_stream = importlib.resources.files("example").joinpath("quotes.yaml").read_text() + return yaml.load(quotes_stream, Loader=yaml.SafeLoader)["quotes"] diff --git a/src/biocommons/example/tests/marvin_subdir_test.py b/src/biocommons/example/tests/marvin_subdir_test.py index 79c431a..0eeecdd 100644 --- a/src/biocommons/example/tests/marvin_subdir_test.py +++ b/src/biocommons/example/tests/marvin_subdir_test.py @@ -3,6 +3,7 @@ from ..marvin import get_quote -def test_get_quote(): +def test_get_quote(all_quotes): """test get_quote""" - assert get_quote() is not None + # NB: all_quotes argument is a test fixture; see ./conftest.py + assert get_quote() in all_quotes