The SuppressOutput context manager was wreaking havoc with pytest. The problem, as noted in #403, is that the context manager closes stdout, which pytest (and ipython) expect to remain open. We originally did this because the multisphere code keeps outputting to stdout even when python attempts to redirect stdout to /dev/null. This is a general problem when wrapping fortran codes in python. This PR fixes this issue by removing the context manager and modifying the amncalc subroutine in scsmfo_min to not print anything unless it is told otherwise. The other place that the SuppressOutput context manager was used was in the code that interfaces with DDA. Since we call ADDA in a subprocess, the output can be suppressed by using the capture_output kwarg of subprocess.run().
Fixes #403. With these changes, pytest now runs, though there is some additional work to do to fully integrate it.
The
SuppressOutput
context manager was wreaking havoc withpytest
. The problem, as noted in #403, is that the context manager closesstdout
, whichpytest
(andipython
) expect to remain open. We originally did this because the multisphere code keeps outputting tostdout
even when python attempts to redirectstdout
to/dev/null
. This is a general problem when wrapping fortran codes in python. This PR fixes this issue by removing the context manager and modifying theamncalc
subroutine inscsmfo_min
to not print anything unless it is told otherwise. The other place that theSuppressOutput
context manager was used was in the code that interfaces with DDA. Since we call ADDA in a subprocess, the output can be suppressed by using thecapture_output
kwarg ofsubprocess.run()
.Fixes #403. With these changes,
pytest
now runs, though there is some additional work to do to fully integrate it.