Skip to content

Commit

Permalink
update tests for nomad example
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspie committed Nov 26, 2024
1 parent f614071 commit 882c2bf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.7.0
rev: v0.8.0
hooks:
# Run the linter.
- id: ruff
Expand Down
1 change: 1 addition & 0 deletions src/pynxtools_xps/nomad/entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@
[NXmpes](https://manual.nexusformat.org/classes/contributed_definitions/NXmpes.html#nxmpes)
application definition from an example measurement file and a subseqeuent analysis of that data set.
""",
plugin_package="pynxtools_xps",
resources=["nomad/examples/*"],
)
27 changes: 16 additions & 11 deletions tests/test_nomad_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,33 +38,38 @@
from pynxtools_xps.nomad.entrypoints import xps_example


EXAMPLE_PATH = os.path.join(
os.path.dirname(__file__),
"..",
"src",
"pynxtools_xps",
"nomad",
"examples",
)


@pytest.mark.parametrize(
"mainfile",
get_file_parameter(
os.path.join(
os.path.dirname(__file__), "..", "src", "pynxtools_xps", "nomad", "examples"
)
),
get_file_parameter(EXAMPLE_PATH),
)
def test_parse_nomad_examples(mainfile):
"""Test if NOMAD examples work."""
parse_nomad_examples(mainfile)
archive_dict = parse_nomad_examples(mainfile)


@pytest.mark.parametrize(
("entrypoint", "expected_local_path"),
("entrypoint", "example_path"),
[
pytest.param(
xps_example,
"examples/data/uploads/xps.zip",
EXAMPLE_PATH,
id="xps_example",
),
],
)
def test_nomad_example_upload_entry_point_valid(entrypoint, expected_local_path):
def test_example_upload_entry_point_valid(entrypoint, example_path):
"""Test if NOMAD ExampleUploadEntryPoint works."""
example_upload_entry_point_valid(
entrypoint=entrypoint,
plugin_package="pynxtools-xps",
expected_local_path=expected_local_path,
example_path=example_path,
)

0 comments on commit 882c2bf

Please sign in to comment.