File tree 3 files changed +21
-2
lines changed
3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 5
5
6
6
7
7
@pytest .fixture
8
- def db ():
8
+ def db (app ):
9
9
db = SQLAlchemy ()
10
+
10
11
yield db
11
12
13
+ with app .app_context ():
14
+ db .session .close ()
15
+ db .engine .dispose ()
16
+
12
17
13
18
@pytest .fixture
14
19
def admin (app , babel , db ):
Original file line number Diff line number Diff line change 5
5
6
6
7
7
@pytest .fixture
8
- def db ():
8
+ def db (app ):
9
9
db = peewee .SqliteDatabase (":memory:" )
10
+
10
11
yield db
11
12
13
+ with app .app_context ():
14
+ db .close ()
15
+
12
16
13
17
@pytest .fixture
14
18
def admin (app , babel , db ):
Original file line number Diff line number Diff line change @@ -23,8 +23,13 @@ def db(app):
23
23
app .config ["SQLALCHEMY_ECHO" ] = True
24
24
app .config ["SQLALCHEMY_TRACK_MODIFICATIONS" ] = False
25
25
db = SQLAlchemy (app )
26
+
26
27
yield db
27
28
29
+ with app .app_context ():
30
+ db .session .close ()
31
+ db .engine .dispose ()
32
+
28
33
29
34
@pytest .fixture
30
35
def postgres_db (app ):
@@ -35,8 +40,13 @@ def postgres_db(app):
35
40
app .config ["SQLALCHEMY_TRACK_MODIFICATIONS" ] = False
36
41
37
42
db = SQLAlchemy (app )
43
+
38
44
yield db
39
45
46
+ with app .app_context ():
47
+ db .session .close ()
48
+ db .engine .dispose ()
49
+
40
50
41
51
@pytest .fixture
42
52
def admin (app , babel , db ):
You can’t perform that action at this time.
0 commit comments