mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-03 10:46:58 +01:00
pytest: Have the db_query helper work on a copy of the DB
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
24ba5d6250
commit
45c935ddba
1 changed files with 6 additions and 1 deletions
|
@ -338,7 +338,12 @@ class LightningNode(object):
|
|||
return [c for c in self.rpc.listchannels()['channels'] if c['active']]
|
||||
|
||||
def db_query(self, query):
|
||||
db = sqlite3.connect(os.path.join(self.daemon.lightning_dir, "lightningd.sqlite3"))
|
||||
from shutil import copyfile
|
||||
orig = os.path.join(self.daemon.lightning_dir, "lightningd.sqlite3")
|
||||
copy = os.path.join(self.daemon.lightning_dir, "lightningd-copy.sqlite3")
|
||||
copyfile(orig, copy)
|
||||
|
||||
db = sqlite3.connect(copy)
|
||||
db.row_factory = sqlite3.Row
|
||||
c = db.cursor()
|
||||
c.execute(query)
|
||||
|
|
Loading…
Add table
Reference in a new issue