I’m working on using the pytest
package to establish tests for some Geant4 code built using g4py
. Normally in pytest
one would do something like the following to test multiple geometries:
@pytest.mark.parametrize('geometry', ['det0', 'det1', 'det2'])
def test_geometries(geometry):
run_example(geometry)
However, each time run_example()
is called we also do import geant4py as g4py
, so we end up reinitializing the kernel without resetting it properly (if I understand correctly). This leads to a segfault on the second geometry tested, det1
.
My question: is there a way to properly reset the kernel in this g4py
framework, or should I restructure how I sweep over multiple geometries?