Add unit tests for all user side functions of the Micro Manager
IshaanDesai opened this issue · 2 comments
All the functions in the file micro_manager/micro_manager.py
needs to have unit tests for testing their behavior in several situations.
Due to the nature of the micro-manager, we need a dummy class that is passed to the micro-manager that the micro-problem can extend. Otherwise we can't test the initialization and the solve function for example is also called on this micro-solver and we do not get an output of the MicroManager.solve
function if we do not pass some class that implements the solve function.
The micro-manager package itself imports pyprecice, which also complicates things.
I would propose that we compile the python bindings which the micro-manager is using with a dummy interface, potentially even the interface that is already implemented in the for the python bindings and then call the functions in such a way that we know what output we would get from the python bindings dummy interface.
The other option I am thinking about are
- We do a full macro-micro simulation where we controll two dummy solvers and the tests are within the steps of the simulation.
- Problem here would be that we cant call more internal functions individually such as
write_data_to_precice
as this is a function that is called by e.g.solve
- Problem here would be that we cant call more internal functions individually such as
- We call the
MicroManager
functions directly with dummy input.- Here we run into the problem from above that we still call pyprecice which does not know how to handle the dummy data and will probably fail.
To test the functions in MicroManager class we need to directly call them. The idea of unit tests is to really test only that function, so we should try to keep other software packages as minimal as possible. Lets do the following: mock the Python interface of preCICE and call its functions in the Micro Manager functions that we want to test. We would still do import precice
, but rather than importing pyprecice, we would import the dummy version. Having a dummy micro simulation class makes sense.
In unit testing we should not actually initialize preCICE, as this will unnecessarily complicate things and go more towards an integration test.