Skip to content

Commit

Permalink
pytest: don't copy db to query it.
Browse files Browse the repository at this point in the history
Should be safe to do in-place.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Jun 28, 2021
1 parent fa529b7 commit 1d7dae9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ def get_dsn(self):
return None

def query(self, query):
orig = os.path.join(self.path)
copy = self.path + ".copy"
shutil.copyfile(orig, copy)
db = sqlite3.connect(copy)
db = sqlite3.connect(self.path)

db.row_factory = sqlite3.Row
c = db.cursor()
# Don't get upset by concurrent writes; wait for up to 5 seconds!
c.execute("PRAGMA busy_timeout = 5000");
c.execute(query)
rows = c.fetchall()

Expand Down

0 comments on commit 1d7dae9

Please sign in to comment.