Plugin.__del__ writes DEBUG messages to stdout
Summary
In buildstream/plugin.py::Plugin there exists:
def __del__(self):
# Dont send anything through the Message() pipeline at destruction time,
# any subsequent lookup of plugin by unique id would raise KeyError.
if self.__context.log_debug:
print("DEBUG: Destroyed: {}".format(self))
This writes DEBUG messages to stdout which while normally unseen, can cause the test suite to explode in interesting ways such as:
> assert cli.get_element_state(project, 'target-custom.bst') == "fetch needed"
E AssertionError: assert 'DEBUG: Destr...nfetch needed' == 'fetch needed'
E - DEBUG: Destroyed: script element at element3.bst [line 1 column 0]
E - DEBUG: Destroyed: import element at base.bst [line 1 column 0]
E - DEBUG: Destroyed: local source at base.bst [line 3 column 2]
E fetch needed
This is likely due to Python GC kicking in at the "wrong" moment in the test suite.
Steps to reproduce
Run tests over and over until you're unlucky. Sadly I can't think of a way to trigger this repeatedly.
The above example is from https://gitlab.com/BuildStream/buildstream/-/jobs/118114137 which is part of a pipeline where every other platform succeeded.
What is the current bug behavior?
The DEBUG message goes to stdout
What is the expected correct behavior?
Either the message should be removed, or else should go to stderr (or if possible, whichever channel the log messages would have gone during that run)
Other relevant information
- BuildStream version affected: /milestone %BuildStream_v1.4