From efc4aa94a39ffdb1065a8e69e6af7a7d7ac4706c Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 12 Sep 2019 22:49:42 +0200 Subject: [PATCH] pytest: Skip some tests that assume we have a sqlite3 db on postgres These will not work since they touch the DB file itself. Signed-off-by: Christian Decker --- tests/test_connection.py | 1 + tests/test_db.py | 2 ++ tests/test_misc.py | 1 + tests/test_plugin.py | 1 + 4 files changed, 5 insertions(+) diff --git a/tests/test_connection.py b/tests/test_connection.py index 472a2ec11..8b497cdc0 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -1627,6 +1627,7 @@ def test_funder_simple_reconnect(node_factory, bitcoind): l1.pay(l2, 200000000) +@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "sqlite3-specific DB rollback") @unittest.skipIf(not DEVELOPER, "needs LIGHTNINGD_DEV_LOG_IO") def test_dataloss_protection(node_factory, bitcoind): l1 = node_factory.get_node(may_reconnect=True, log_all_io=True, diff --git a/tests/test_db.py b/tests/test_db.py index 9358519c0..8bf349508 100644 --- a/tests/test_db.py +++ b/tests/test_db.py @@ -1,6 +1,7 @@ from fixtures import * # noqa: F401,F403 from utils import wait_for, sync_blockheight, COMPAT +import os import unittest @@ -116,6 +117,7 @@ def test_max_channel_id(node_factory, bitcoind): @unittest.skipIf(not COMPAT, "needs COMPAT to convert obsolete db") +@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "This test is based on a sqlite3 snapshot") def test_scid_upgrade(node_factory): # Created through the power of sed "s/X'\([0-9]*\)78\([0-9]*\)78\([0-9]*\)'/X'\13A\23A\3'/" diff --git a/tests/test_misc.py b/tests/test_misc.py index bae6fa1b2..bd5c98cc0 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -61,6 +61,7 @@ def test_names(node_factory): .format(key, alias, color)) +@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "This migration is based on a sqlite3 snapshot") def test_db_upgrade(node_factory): l1 = node_factory.get_node() l1.stop() diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 1e253ef91..6f2b85b18 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -290,6 +290,7 @@ def test_async_rpcmethod(node_factory, executor): assert [r.result() for r in results] == [42] * len(results) +@unittest.skipIf(os.getenv('TEST_DB_PROVIDER', 'sqlite3') != 'sqlite3', "Only sqlite3 implements the db_write_hook currently") def test_db_hook(node_factory, executor): """This tests the db hook.""" dbfile = os.path.join(node_factory.directory, "dblog.sqlite3")