Skip to content

Bring the fixture's method entries in line with opm-simulators - #35

Open
hakonhagland wants to merge 1 commit into
OPM:masterfrom
hakonhagland:refresh_simulators_fixture
Open

hakonhagland wants to merge 1 commit into
OPM:masterfrom
hakonhagland:refresh_simulators_fixture

Conversation

@hakonhagland

Copy link
Copy Markdown
Collaborator

python/sphinx_docs/tests/files/docstrings_simulators.json is a copy of the docstring file from opm-simulators, last refreshed in January 2025. Four of its method signatures still use names that the bindings no longer have. No test depends on the fixture's contents, but anything that searches this repository for the Python API finds it. An automated review of #31 did exactly that. It relied on this file and suggested replacing a working sim.setup_mpi(...) call with sim.mpi_init(...), which does not exist.

Bring the fixture's method entries in line with opm-simulators (commit 1)

  • Updates the four stale method names that Fix stale method names in the Python API docstrings opm-simulators#7439 corrected in the real file:
    • mpi_init → setup_mpi
    • get_fluid_state_variable → get_fluidstate_variable
    • get_primary_var_meaning → get_primary_variable_meaning
    • get_primary_var_meaning_map → get_primary_variable_meaning_map
  • Carries over the two other changes the real file has had since the snapshot: the setupMpi docstring's inline literal no longer has a stray third backtick, and checkSimulationFinished now documents its return type.
  • Keeps the file's existing format and key order, so the diff is six lines.

Verification

  • Compared every method entry with python/docstrings_simulators.json on opm-simulators master, with {{name}} expanded to BlackOilSimulator. All 17 method entries are now identical in both signature and docstring; before this change 13 signatures matched.
  • The test suite passes before and after. The fixture is only copied into a temporary repository by conftest.py, and test_view_docs.py checks only the URL that gets opened, so no test reads its contents.

Not included: the constructors

The fixture documents the two constructors as __init__(deck_filename: str) and __init__(deck, state, schedule, summary_config). That matches the real file in opm-simulators, but the bindings name these arguments differently: filename, and Deck, EclipseState, Schedule, SummaryConfig, plus an optional args that is not documented at all. Passing the arguments by keyword as currently documented raises TypeError, while passing them by position works, which is what the existing examples do.

That needs fixing in opm-simulators first, since the fixture should stay a copy of the real file. I will open that as a follow-up to OPM/opm-simulators#7439 and then refresh the fixture's constructor entries to match, either here or in a small follow-up PR, depending on which merges first.

tests/files/docstrings_simulators.json is a snapshot of the docstring
file from opm-simulators, last refreshed in January 2025. Four of its
method signatures still use names that the bindings no longer have:

  mpi_init                     now setup_mpi
  get_fluid_state_variable     now get_fluidstate_variable
  get_primary_var_meaning      now get_primary_variable_meaning
  get_primary_var_meaning_map  now get_primary_variable_meaning_map

OPM/opm-simulators#7439 corrected these in the real file. The fixture
kept them, and a review of OPM#31 took the
fixture as the definition of the API and suggested replacing a working
setup_mpi() call with mpi_init(), which does not exist.

Also carries over the two other changes the real file has since had:
the setupMpi docstring's inline literal no longer has a third backtick,
and checkSimulationFinished documents its return type.

All 17 method entries are now identical to the real file on
opm-simulators master, with {{name}} expanded to BlackOilSimulator. No
test depends on the fixture's contents; conftest.py only copies it into
a temporary repository.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The fixture changes are focused, verified, and contain no blocking issues.

Review effort: Lite
Findings: None

What changed in this PR

Updates the simulator docstring fixture to match current upstream method names and documentation.

Changes:

  • Corrects four stale method signatures.
  • Fixes MPI literal formatting.
  • Adds the checkSimulationFinished return type.
File Description
python/​sphinx_docs/​tests/​files/​docstrings_simulators.json Synchronizes simulator method entries with upstream bindings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch has not been deployed

No deployments
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.

2 participants