Skip to content

Commit 3283403

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#26882: test: skip sqlite3 tests if it isn't available
eea73d4 test: skip sqlite3 tests if it isn't available (fanquake) Pull request description: Fixes #26819. Related too #26873, which adds the missing documentation. ACKs for top commit: brunoerg: ACK eea73d4 Tree-SHA512: 9bcf5c642695c39a58d56ef8bf4d62601ab0acd4ad71c9400b9d8a2a336a1cd55b69408a02c583d9a67c5de0286364c9f38debd03ec8316725ad69450d980f0d
2 parents 07c54de + eea73d4 commit 3283403

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

test/functional/test_framework/test_framework.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,13 @@ def skip_if_no_py3_zmq(self):
854854
except ImportError:
855855
raise SkipTest("python3-zmq module not available.")
856856

857+
def skip_if_no_py_sqlite3(self):
858+
"""Attempt to import the sqlite3 package and skip the test if the import fails."""
859+
try:
860+
import sqlite3 # noqa
861+
except ImportError:
862+
raise SkipTest("sqlite3 module not available.")
863+
857864
def skip_if_no_python_bcc(self):
858865
"""Attempt to import the bcc package and skip the tests if the import fails."""
859866
try:

test/functional/wallet_descriptor.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test descriptor wallet function."""
66
import os
7-
import sqlite3
7+
8+
try:
9+
import sqlite3
10+
except ImportError:
11+
pass
812

913
from test_framework.blocktools import COINBASE_MATURITY
1014
from test_framework.test_framework import BitcoinTestFramework
@@ -27,6 +31,7 @@ def set_test_params(self):
2731
def skip_test_if_missing_module(self):
2832
self.skip_if_no_wallet()
2933
self.skip_if_no_sqlite()
34+
self.skip_if_no_py_sqlite3()
3035

3136
def run_test(self):
3237
if self.is_bdb_compiled():

0 commit comments

Comments
 (0)