SimVascular / SimVascular/svMultiPhysics

Move CI pytest Python files into the appropriate test subdirectories

Open
#391 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement future development
Dominant language
C++
Stars
45
Forks
60
Avg merge
5d 23h
Merged PRs (30d)
11

Description

Use Case

The continuous integration (CI) simulation results testing using pytest to execute the svMultiPhysics solver and compare simulation results.

The svMultiPhysics/tests directory currently contains pytest Python test__EQUATION._py files for each svMultiPhysics equation: cep, cmm, fluid, etc.

__init__.py		test_cmm.py		test_heats.py		test_struct.py
conftest.py		test_fluid.py		test_shell.py		test_ustruct.py
test_cep.py		test_fsi.py		test_stokes.py

The appropriate test__EQUATION._py file must be modified when adding a new test. For example, test_fluid.py has pytest functions for each fluid test case

def test_pipe_RCR_3d(n_proc):
    test_folder = "pipe_RCR_3d"
    t_max = 2
    run_with_reference(base_folder, test_folder, fields, n_proc, t_max)

def test_pipe_RCR_3d_petsc(n_proc):
    test_folder = "pipe_RCR_3d_petsc"
    t_max = 2
    run_with_reference(base_folder, test_folder, fields, n_proc, t_max)

...

which has a lot of hard-coded information like directory names and tolerances for different simulation primary and secondary quantities.

Problem

See above.

Solution

It would be cleaner to have a pytest _test.py file located in each test case directory that is relevant to that simulation only: time step to compare, tolerances, etc.

When creating a new test the developer just needs to add a _test.py file to the test directory and determine the relevant tolerances.

Alternatives considered

None.

Additional context

No response

Code of Conduct
  • I agree to follow this project's Code of Conduct and Contributing Guidelines

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in svMultiPhysics/tests by reviewing conftest.py and the equation-specific files such as test_fluid.py, then inspect the referenced simulation test-case directories. Trace how pytest currently discovers and runs the hard-coded cases, tolerances, and comparison times. Done means the relevant cases use local _test.py files and CI still performs the expected result comparisons.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.