Browse Source

Generate tests is cool

master
Raphael Roberts 5 years ago
parent
commit
c7633f66c3
  1. 16
      tests/conftest.py
  2. 3
      tests/test_backup_class.py
  3. 4
      tests/test_parser_on_data.py

16
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"
),
)

3
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))

4
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()

Loading…
Cancel
Save