-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
39 lines (32 loc) · 855 Bytes
/
conftest.py
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
39
import pytest
import app as webapp
import DBcm
from appconfig import config
@pytest.fixture
def app():
"""
this fixture creates the client object before each test runs, assuming the test
references the client object.
"""
app = webapp.app
return app
@pytest.fixture
def clean_up_db():
"""
This code removes any and all test data from the database *after*
the tests which refer to it run
"""
# this code,before the yield, runs befre the test runs.
yield
# this code, after the yield, runs after the test completes.
with DBcm.UseDatabase(config) as db:
SQL = """
delete from visitors
where fname = "test"
"""
db.execute(SQL)
SQL = """
delete from visitors
where fname = "tester"
"""
db.execute(SQL)