From 429e2df6ceef715d5f33a995056292a5647a880d Mon Sep 17 00:00:00 2001 From: Cryp Toon Date: Wed, 7 Feb 2024 19:43:02 +0100 Subject: [PATCH] Fix cache database for PostgreSQL --- tests/bitcoinlib_cache_unittest1 | Bin 57344 -> 57344 bytes tests/bitcoinlib_cache_unittest2 | Bin 57344 -> 57344 bytes tests/test_services.py | 10 +++++++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/bitcoinlib_cache_unittest1 b/tests/bitcoinlib_cache_unittest1 index b103c21d46cdcc8eb8fb26fae8c7a6a5a1dfb5b2..a4ac3cc18cf9af2d8fc9df470b1aeb8e4eac9c76 100644 GIT binary patch delta 35 kcmZoTz}#?vd4jZ{8v_Fa9~AQfX}5_w#*A(o6BgVD0E99JzW@LL delta 35 kcmZoTz}#?vd4jZ{1p@;E9~AQfX^V+E#*7vl6BgVD0D<%el>h($ diff --git a/tests/bitcoinlib_cache_unittest2 b/tests/bitcoinlib_cache_unittest2 index b103c21d46cdcc8eb8fb26fae8c7a6a5a1dfb5b2..a4ac3cc18cf9af2d8fc9df470b1aeb8e4eac9c76 100644 GIT binary patch delta 35 kcmZoTz}#?vd4jZ{8v_Fa9~AQfX}5_w#*A(o6BgVD0E99JzW@LL delta 35 kcmZoTz}#?vd4jZ{1p@;E9~AQfX^V+E#*7vl6BgVD0D<%el>h($ diff --git a/tests/test_services.py b/tests/test_services.py index 99835e93..ec2d6571 100644 --- a/tests/test_services.py +++ b/tests/test_services.py @@ -820,9 +820,13 @@ def setUpClass(cls): try: con = psycopg.connect(user='postgres', host='localhost', password='postgres', autocommit=True) cur = con.cursor() - cur.execute(sql.SQL("CREATE DATABASE {}").format( - sql.Identifier('bitcoinlibcache.unittest')) - ) + try: + cur.execute(sql.SQL("DROP DATABASE IF EXISTS {}").format(sql.Identifier(CACHE_DBNAME1))) + cur.execute(sql.SQL("DROP DATABASE IF EXISTS {}").format(sql.Identifier(CACHE_DBNAME2))) + cur.execute(sql.SQL("CREATE DATABASE {}").format(sql.Identifier(CACHE_DBNAME1))) + cur.execute(sql.SQL("CREATE DATABASE {}").format(sql.Identifier(CACHE_DBNAME2))) + except: + pass cur.close() con.close() except Exception: