diff options
author | Suhas Daftuar <sdaftuar@gmail.com> | 2018-04-06 10:53:35 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-04-20 18:38:41 -0400 |
commit | 6c26df06adc55ef7c27891a52a8feccec58b4aea (patch) | |
tree | 5208a81a56ef5fb5cde8ed495591255a5929775f /test/functional/test_framework/test_node.py | |
parent | df38b130d957afbeda8be34a649f6e406f4c79b3 (diff) |
[qa] Ensure bitcoind processes are cleaned up when tests end
Github-Pull: #12904
Rebased-From: e36a0c08529bccc695ec71a7ec1df89367cc1628
Diffstat (limited to 'test/functional/test_framework/test_node.py')
-rwxr-xr-x | test/functional/test_framework/test_node.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 1054e6d028..19db11d8a3 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -70,9 +70,20 @@ class TestNode(): self.rpc = None self.url = None self.log = logging.getLogger('TestFramework.node%d' % i) + self.cleanup_on_exit = True # Whether to kill the node when this object goes away self.p2ps = [] + def __del__(self): + # Ensure that we don't leave any bitcoind processes lying around after + # the test ends + if self.process and self.cleanup_on_exit: + # Should only happen on test failure + # Avoid using logger, as that may have already been shutdown when + # this destructor is called. + print("Cleaning up leftover process") + self.process.kill() + def __getattr__(self, name): """Dispatches any unrecognised messages to the RPC connection or a CLI instance.""" if self.use_cli: |