forked from piccolo-orm/piccolo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
38 lines (28 loc) · 825 Bytes
/
conftest.py
File metadata and controls
38 lines (28 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import asyncio
from piccolo.engine.finder import engine_finder
ENGINE = engine_finder()
async def drop_tables():
for table in [
"venue",
"concert",
"band",
"manager",
"ticket",
"poster",
"migration",
"musician",
"my_table",
]:
await ENGINE._run_in_new_connection(f"DROP TABLE IF EXISTS {table}")
def pytest_sessionstart(session):
"""
Make sure all the tables have been dropped.
https://docs.pytest.org/en/latest/reference.html#_pytest.hookspec.pytest_configure
"""
print("Session starting")
asyncio.run(drop_tables())
def pytest_sessionfinish(session, exitstatus):
"""
https://docs.pytest.org/en/latest/reference.html#_pytest.hookspec.pytest_sessionfinish
"""
print("Session finishing")