ENH: add error filtering; optionally reuse SubprocessTao
in the test suite
#95
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
Closes #85
Closes #96
Closes #97 (context manager portion; not weakref)
Reduces build/test workflow on CI from 20 minutes to 10 minutes (roughly 8 minutes for the test suite)
Added
filter_tao_messages()
andfilter_tao_messages_context()
to selectively filter Tao output messages that originate from certain Fortran functionsfilter_tao_messages
applies to all Tao calls throughout the life of the program:filter_tao_messages_context
is a context manager that can be used for specific sections of code:Message filtering can be done with a bit of granularity:
functions
, a list of Tao Fortran function names)by_level
, a dictionary of severity - e.g.,"ERROR"
- to a list of function names)by_command
, a dictionary of command - e.g.,"set"
- to a list of function names)Test suite: reuse
SubprocessTao
in the test suiteTAO_REUSE_SUBPROCESS=n
, pytest-xdist is detected, or GitHub Actions runner debug mode is onSubprocessTao
utilizescapture()
to selectively exclude the problematictao_find_plots
messages only duringinit
SubprocessTao
itself is now a context manager, for easier resource managementAdd
tao.last_output
to get the last text output retrieved from TaoTODO
capture
and/or change how it can be importedcapture
usageConsider adding weakref support here tooBackground
SubprocessTao
- which spins up a new, isolated subprocess with Tao (~10 minutes)With this PR, locally I can make the entire test suite run in 3:30 (vs about 15 minutes) on my laptop reusing a single subprocess. However, Tao itself fails to reinitialize in 13 tests, so we will need to address those test cases.
Fixing the failing test cases indicated that it was time to address #96 and #85 at the same time.
SubprocessTao
was succeeding whereTao
was failing was due to a long-standing bugTao()
initialization ignoresERROR
in output on first init (but not on reinitialization) #96 where initialization vs reinitialization error handling was inconsistent:tao_c_init_tao
and only error if Tao itself reported an errorERROR
and similar in the output text linesNow, the ERL example startup file includes plotting commands:
-external_plotting