Skip to content

Commit 7d70aa0

Browse files
committed
fixup: few improvements
1 parent cbe4139 commit 7d70aa0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pytest_postgresql/factories/noprocess.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def postgresql_noproc_fixture(request: FixtureRequest) -> Iterator[NoopExecutor]
6969
"""
7070
config = get_config(request)
7171

72-
base_template_dbname = None
7372
if depends_on:
7473
base = request.getfixturevalue(depends_on)
7574
pg_host = host or base.host
@@ -84,13 +83,15 @@ def postgresql_noproc_fixture(request: FixtureRequest) -> Iterator[NoopExecutor]
8483
pg_user = user or config.user
8584
pg_password = password or config.password
8685
pg_options = options or config.options
86+
base_template_dbname = None
8787

8888
pg_dbname = xdistify_dbname(dbname or config.dbname)
89-
pg_options = options or config.options
9089
pg_load = load or config.load
9190
drop_test_database = config.drop_test_database
9291

93-
if depends_on:
92+
# In this case there's a risk that both seeded and depends_on fixture
93+
# might end up with the same configured dbname.
94+
if depends_on and not dbname:
9495
noop_exec_dbname = f"{pg_dbname}_{depends_on}"
9596
else:
9697
noop_exec_dbname = pg_dbname
@@ -112,7 +113,7 @@ def postgresql_noproc_fixture(request: FixtureRequest) -> Iterator[NoopExecutor]
112113
version=noop_exec.version,
113114
password=noop_exec.password,
114115
)
115-
if drop_test_database is True:
116+
if drop_test_database:
116117
janitor.drop()
117118
with janitor:
118119
for load_element in pg_load:

0 commit comments

Comments
 (0)