diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2023-08-02 19:29:01 +0100 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2023-08-02 19:29:01 +0100 |
commit | 703b758e187492d4752270cd9922eaf0af20e2d0 (patch) | |
tree | 45b3f12b4e17e8ea90b3da28871a1dbf0a572e5b /test | |
parent | 2fa60f0b683cefd7956273986dafe3bde00c98fd (diff) |
qa: Close SQLite connection properly
Connection object used as context manager only commits or rollbacks
transactions, so the connection object should be closed manually.
Fixes the following error on Windows:
```
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: ...
```
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/wallet_descriptor.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/functional/wallet_descriptor.py b/test/functional/wallet_descriptor.py index f4b67bae1b..6f563987cc 100755 --- a/test/functional/wallet_descriptor.py +++ b/test/functional/wallet_descriptor.py @@ -235,9 +235,11 @@ class WalletDescriptorTest(BitcoinTestFramework): self.nodes[0].createwallet(wallet_name="crashme", descriptors=True) self.nodes[0].unloadwallet("crashme") wallet_db = os.path.join(self.nodes[0].wallets_path, "crashme", self.wallet_data_filename) - with sqlite3.connect(wallet_db) as conn: + conn = sqlite3.connect(wallet_db) + with conn: # add "cscript" entry: key type is uint160 (20 bytes), value type is CScript (zero-length here) conn.execute('INSERT INTO main VALUES(?, ?)', (b'\x07cscript' + b'\x00'*20, b'\x00')) + conn.close() assert_raises_rpc_error(-4, "Unexpected legacy entry in descriptor wallet found.", self.nodes[0].loadwallet, "crashme") |