mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 02:48:38 -04:00
Every test gets its own db.
This commit is contained in:
parent
2e10a06a38
commit
d9a48e2325
1 changed files with 4 additions and 2 deletions
|
|
@ -1,4 +1,6 @@
|
|||
import functools
|
||||
import random
|
||||
import string
|
||||
|
||||
import mock
|
||||
import psycopg2
|
||||
|
|
@ -7,8 +9,6 @@ from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
|
|||
|
||||
from wrolpi.common import setup_relations
|
||||
|
||||
TESTING_DB_NAME = 'wrolpi_testing'
|
||||
|
||||
|
||||
def test_db_wrapper(func):
|
||||
"""
|
||||
|
|
@ -25,6 +25,8 @@ def test_db_wrapper(func):
|
|||
port=54321,
|
||||
)
|
||||
|
||||
TESTING_DB_NAME = 'wrolpi_testing_' + ''.join(random.choices(string.ascii_lowercase, k=20))
|
||||
|
||||
# Set isolation level such that was can copy the schema of the "wrolpi" database for testing
|
||||
with psycopg2.connect(dbname='postgres', **db_args) as db_conn:
|
||||
db_conn.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue