Skip to content

Parameterize data-based tests and make data path configurable - #58

Open
krystophny wants to merge 1 commit into
mainfrom
slopqueue/019fe0933da3-2ca3e15d
Open

Parameterize data-based tests and make data path configurable#58
krystophny wants to merge 1 commit into
mainfrom
slopqueue/019fe0933da3-2ca3e15d

Conversation

@krystophny

Copy link
Copy Markdown
Member

Summary

Closes #6

This change makes the data-based test suite configurable and properly
parameterized:

  • Configurable data/code paths via command line. The data_path and
    code_path fixtures in tests/conftest.py now accept the new
    --data-path / --code-path pytest command-line options (as suggested
    by the linked StackOverflow discussion) and fall back to the DATA /
    CODE environment variables when the options are not given. This makes
    it possible to point the tests at the "standard data" directory on any
    machine without relying on fixed environment variables.

  • Parameterized tests over standard data. The EQDSK tests
    (test_eqdsk_read, test_eqdsk_golden_records) and the
    efit_to_boozer q-profile comparison are now driven by
    @pytest.mark.parametrize over the set of standard reference data
    files instead of looping manually. Each data file is reported as its
    own test case, so failures are easier to isolate and individual files
    can be selected or deselected.

  • Move tests upstream / clean standalone tests. The standalone NEO-RT
    benchmark test_util no longer invokes the test at module import time,
    so it runs exactly once as a proper pytest test and does not execute
    when merely imported elsewhere.

Tests

  • Verified --data-path / --code-path options work and produce a clear
    UsageError when neither an option nor the environment variable is set.
  • Verified the parametrize pattern collects each standard data file as a
    separate test case.
  • Ran the standalone NEO-RT benchmark test_util.py with pytest
    (1 passed).
  • The libneo-based tests could not be executed here because the
    libneo Python module is not shipped in this repository (it is cloned
    separately in CI), but the changes are syntactically valid and follow
    the existing parametrize pattern.

Add pytest command-line options --data-path/--code-path so the shared
data and code roots can be passed on the command line with fallback to
the DATA/CODE environment variables. Parametrize the EQDSK and
efit_to_boozer tests over the standard reference data files so each is
a distinct test case, and remove the module-level invocation from the
standalone NEO-RT benchmark util test so it runs once under pytest.

@krystophny krystophny left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review verdict: Comment

Summary: The test-only changes are scoped and syntactically sound; parameterization and path overrides preserve existing behavior.

Findings: No findings.

Verdict: Comment — no defect found, but CI is still in progress and libneo tests could not be run locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement parameterized tests with standard data and move tests upstream where possible

1 participant