From 261abf79e1c0faed88e1c4f14fdd925586f776b3 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 27 Oct 2019 16:20:13 +0000 Subject: [PATCH] functional_tests: ensure mining stops on error in mining test this prevents messing up any subsequent test too --- tests/functional_tests/mining.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/functional_tests/mining.py b/tests/functional_tests/mining.py index ad646417e..d067c25e1 100755 --- a/tests/functional_tests/mining.py +++ b/tests/functional_tests/mining.py @@ -170,5 +170,15 @@ class MiningTest(): assert res.hash == block_hash +class Guard: + def __enter__(self): + pass + + def __exit__(self, exc_type, exc_value, traceback): + daemon = Daemon() + try: daemon.stop_mining() + except: pass + if __name__ == '__main__': - MiningTest().run_test() + with Guard() as guard: + MiningTest().run_test()