File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -53,22 +53,22 @@ def _make_temp_directory(**kw):
53
53
54
54
55
55
@pytest .fixture
56
- def freshdb ():
56
+ def freshdb (cicd ):
57
57
""" Creates a fresh database for each test.
58
58
59
59
Default configuration is using peer authentication method on
60
60
Postgresql's Unix Domain Socket.
61
61
"""
62
62
from yhttp .ext .dbmanager import PostgresqlManager
63
63
64
- host = os .environ .get ('YHTTPDEV_DB_HOST' , '' )
65
- user = os .environ .get ('YHTTPDEV_DB_USER' , '' )
66
- password = os .environ .get ('YHTTPDEV_DB_PASS' , '' )
64
+ host = os .environ .get ('YHTTP_DB_DEFAULT_HOST' , 'localhost' if cicd else '' )
65
+ user = os .environ .get ('YHTTP_DB_DEFAULT_USER' , 'postgres' if cicd else '' )
66
+ pass_ = os .environ .get ('YHTTP_DB_DEFAULT_PASS' , 'postgres' if cicd else '' )
67
67
68
68
dbname = f'freshdb_{ datetime .datetime .now ():%Y%m%d%H%M%S} '
69
- dbmanager = PostgresqlManager (host , 'postgres' , user , password )
69
+ dbmanager = PostgresqlManager (host , 'postgres' , user , pass_ )
70
70
dbmanager .create (dbname , dropifexists = True )
71
- freshurl = f'postgres://{ user } :{ password } @{ host } /{ dbname } '
71
+ freshurl = f'postgres://{ user } :{ pass_ } @{ host } /{ dbname } '
72
72
yield freshurl
73
73
dbmanager .dropifexists (dbname )
74
74
You can’t perform that action at this time.
0 commit comments