From ec372adbb9dbe917e830af5ee5e2972383933581 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Sun, 22 Sep 2019 21:21:24 +0200 Subject: [PATCH] tests: fix test_find_path_for_payment. need to close sqlite connection test was sometimes randomly failing (always on Windows, as it's illegal to rm open files there) --- electrum/sql_db.py | 1 + electrum/tests/test_lnrouter.py | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/electrum/sql_db.py b/electrum/sql_db.py index f86b23237..bf57b157f 100644 --- a/electrum/sql_db.py +++ b/electrum/sql_db.py @@ -54,4 +54,5 @@ class SqlDB(Logger): self.conn.commit() # write self.conn.commit() + self.conn.close() self.logger.info("SQL thread terminated") diff --git a/electrum/tests/test_lnrouter.py b/electrum/tests/test_lnrouter.py index ba181a573..704dd2e5c 100644 --- a/electrum/tests/test_lnrouter.py +++ b/electrum/tests/test_lnrouter.py @@ -105,7 +105,10 @@ class Test_LNRouter(TestCaseForTestnet): self.assertEqual(route[0].node_id, start_node) self.assertEqual(route[0].short_channel_id, bfh('0000000000000003')) - + # need to duplicate tear_down here, as we also need to wait for the sql thread to stop + self.asyncio_loop.call_soon_threadsafe(self._stop_loop.set_result, 1) + self._loop_thread.join(timeout=1) + cdb.sql_thread.join(timeout=1) def test_new_onion_packet(self): # test vector from bolt-04