aboutsummaryrefslogtreecommitdiff
path: root/tests/functional_tests/mining.py
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-10-27 16:20:13 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-10-27 16:21:30 +0000
commit261abf79e1c0faed88e1c4f14fdd925586f776b3 (patch)
tree754ed8cded621889df270eb19b39ec180956237e /tests/functional_tests/mining.py
parentMerge pull request #6036 (diff)
downloadmonero-261abf79e1c0faed88e1c4f14fdd925586f776b3.tar.xz
functional_tests: ensure mining stops on error in mining test
this prevents messing up any subsequent test too
Diffstat (limited to 'tests/functional_tests/mining.py')
-rwxr-xr-xtests/functional_tests/mining.py12
1 files changed, 11 insertions, 1 deletions
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()