Skip to content

Commit

Permalink
Use fixture variable name directly
Browse files Browse the repository at this point in the history
Signed-off-by: d10n <[email protected]>
  • Loading branch information
d10n committed Nov 14, 2024
1 parent fdcf440 commit 88de404
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions tests/trestle/core/commands/validate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,14 @@ def test_validation_happy(
name, mode, parent, tmp_trestle_dir: pathlib.Path, testdata_dir: pathlib.Path, monkeypatch: MonkeyPatch
) -> None:
"""Test successful validation runs."""
test_data_dir = testdata_dir
(tmp_trestle_dir / test_utils.CATALOGS_DIR / 'my_test_model').mkdir(exist_ok=True, parents=True)
(tmp_trestle_dir / test_utils.CATALOGS_DIR / 'my_test_model2').mkdir(exist_ok=True, parents=True)
shutil.copyfile(
test_data_dir / 'json/minimal_catalog.json',
testdata_dir / 'json/minimal_catalog.json',
tmp_trestle_dir / test_utils.CATALOGS_DIR / 'my_test_model/catalog.json'
)
shutil.copyfile(
test_data_dir / 'json/minimal_catalog.json',
testdata_dir / 'json/minimal_catalog.json',
tmp_trestle_dir / test_utils.CATALOGS_DIR / 'my_test_model2/catalog.json'
)

Expand Down Expand Up @@ -105,15 +104,14 @@ def test_validation_unhappy(
name, mode, parent, status, tmp_trestle_dir: pathlib.Path, testdata_dir: pathlib.Path, monkeypatch: MonkeyPatch
) -> None:
"""Test failure modes of validation."""
test_data_dir = testdata_dir
(tmp_trestle_dir / test_utils.CATALOGS_DIR / 'my_test_model').mkdir(exist_ok=True, parents=True)
(tmp_trestle_dir / test_utils.CATALOGS_DIR / 'my_test_model2').mkdir(exist_ok=True, parents=True)
shutil.copyfile(
test_data_dir / 'json/minimal_catalog_bad_oscal_version.json',
testdata_dir / 'json/minimal_catalog_bad_oscal_version.json',
tmp_trestle_dir / test_utils.CATALOGS_DIR / 'my_test_model/catalog.json'
)
shutil.copyfile(
test_data_dir / 'json/minimal_catalog.json',
testdata_dir / 'json/minimal_catalog.json',
tmp_trestle_dir / test_utils.CATALOGS_DIR / 'my_test_model2/catalog.json'
)

Expand Down Expand Up @@ -427,11 +425,9 @@ def test_validate_component_definition(
tmp_trestle_dir: pathlib.Path, testdata_dir: pathlib.Path, monkeypatch: MonkeyPatch
) -> None:
"""Test validation of Component Definition."""
test_data_dir = testdata_dir

jfile = 'component-definition.json'

sdir = test_data_dir / 'validate' / 'component-definitions' / 'x1'
sdir = testdata_dir / 'validate' / 'component-definitions' / 'x1'
spth = sdir / f'{jfile}'

tdir = tmp_trestle_dir / test_utils.COMPONENT_DEF_DIR / 'my_test_model'
Expand All @@ -448,10 +444,9 @@ def test_validate_component_definition_ports(
tmp_trestle_dir: pathlib.Path, testdata_dir: pathlib.Path, monkeypatch: MonkeyPatch
) -> None:
"""Test validation of ports in Component Definition."""
test_data_dir = testdata_dir
jfile = 'component-definition.json'

sdir = test_data_dir / 'validate' / 'component-definitions' / 'x2'
sdir = testdata_dir / 'validate' / 'component-definitions' / 'x2'
spth = sdir / f'{jfile}'

tdir = tmp_trestle_dir / test_utils.COMPONENT_DEF_DIR / 'my_test_model'
Expand All @@ -468,11 +463,9 @@ def test_validate_component_definition_ports_invalid(
tmp_trestle_dir: pathlib.Path, testdata_dir: pathlib.Path, monkeypatch: MonkeyPatch
) -> None:
"""Test validation of ports in Component Definition."""
test_data_dir = testdata_dir

jfile = 'component-definition.json'

sdir = test_data_dir / 'validate' / 'component-definitions' / 'x3'
sdir = testdata_dir / 'validate' / 'component-definitions' / 'x3'
spth = sdir / f'{jfile}'

tdir = tmp_trestle_dir / test_utils.COMPONENT_DEF_DIR / 'my_test_model'
Expand Down

0 comments on commit 88de404

Please sign in to comment.