svalinn / dagmc_stats

Tool for calculating and reporting statistics about DAGMC models
BSD 3-Clause "New" or "Revised" License
1 stars 5 forks source link

Use test fixtures in DagmcQuery tests #86

Open gonuke opened 3 years ago

gonuke commented 3 years ago

Currently, the test for DagmcQuery require each test to open/read the same mesh file to perform queries.

pytest has built in functionality to allow you to create a DagmcFile object once and reuse it in each test, with a concept called a fixture.

It may also be possible to use a fixture to create a single DagmcQuery object to use over multiple tests, but I haven't thought through the logic of that.

shimwell commented 3 years ago

Sounds very possible. we used the setup feature. There is also tear down option as well but I've not used that yet.

https://github.com/fusion-energy/paramak/blob/7c44d7c2d97c84e2914499a64ca1ed4bb28da49c/tests/test_parametric_reactors/test_ball_reactor.py#L14-L31