diff --git a/tests/conftest.py b/tests/conftest.py index 13bd3c6..fa8fef5 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1 +1,15 @@ -from fixtures.load import canned_data_input, canned_data_output +from pathlib import Path + +import pytest + +from .fixtures.load import canned_data_input, canned_data_output + + +def pytest_generate_tests(metafunc): + if "property_filepath" in metafunc.fixturenames: + metafunc.parametrize( + "property_filepath", + Path((metafunc.config.rootdir / "/test_data/mock_backup_data")).glob( + "*.properties" + ), + ) diff --git a/tests/test_backup_class.py b/tests/test_backup_class.py index 22af37d..41a21ea 100644 --- a/tests/test_backup_class.py +++ b/tests/test_backup_class.py @@ -5,8 +5,5 @@ from tibi_hardlinks.backup_parser import read_backup_properties from tibi_hardlinks.backups import find_backup_data, Backup -@pytest.mark.parametrize( - "property_filepath", Path("../test_data/mock_backup_data").glob("*.properties") -) def test_find_backup_data_on_files(property_filepath): find_backup_data(property_filepath, read_backup_properties(property_filepath)) diff --git a/tests/test_parser_on_data.py b/tests/test_parser_on_data.py index 5e5e22e..1b8a615 100644 --- a/tests/test_parser_on_data.py +++ b/tests/test_parser_on_data.py @@ -1,5 +1,4 @@ import pytest -from pathlib import Path from tibi_hardlinks.backup_parser import parse_property_text @@ -18,9 +17,6 @@ def test_canned_data(filename, canned_data_input, canned_data_output): assert experimental[key] == value -@pytest.mark.parametrize( - "property_filepath", Path("../test_data/mock_backup_data").glob("*.properties") -) def test_parser_no_errors(property_filepath): with open(property_filepath) as property_file: data = property_file.read()