functional_tests: ensure mining stops on error in mining test

this prevents messing up any subsequent test too
This commit is contained in:
moneromooo-monero 2019-10-27 16:20:13 +00:00
parent b928ead30e
commit 261abf79e1
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

View File

@ -170,5 +170,15 @@ class MiningTest():
assert res.hash == block_hash 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__': if __name__ == '__main__':
MiningTest().run_test() with Guard() as guard:
MiningTest().run_test()