File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 6
6
from aws_xray_sdk .core import xray_recorder , lambda_launcher
7
7
from aws_xray_sdk .core .context import Context
8
8
from aws_xray_sdk .core .models import http , facade_segment , segment
9
+ from aws_xray_sdk .core import patch
9
10
from tests .util import get_new_stubbed_recorder
10
11
import os
11
12
@@ -66,6 +67,7 @@ def test_fault(self):
66
67
assert exception .type == 'KeyError'
67
68
68
69
def test_db (self ):
70
+ patch (('sqlite3' ,))
69
71
url = reverse ('call_db' )
70
72
self .client .get (url )
71
73
segment = xray_recorder .emitter .pop ()
Original file line number Diff line number Diff line change 6
6
from aws_xray_sdk .core import xray_recorder
7
7
from aws_xray_sdk .core .context import Context
8
8
9
- patch (('sqlite3' ,))
10
- db = sqlite3 .connect (":memory:" )
9
+
10
+ @pytest .fixture (scope = "module" )
11
+ def db ():
12
+ patch (('sqlite3' ,))
13
+ return sqlite3 .connect (":memory:" )
11
14
12
15
13
16
@pytest .fixture (autouse = True )
@@ -24,7 +27,8 @@ def construct_ctx():
24
27
xray_recorder .clear_trace_entities ()
25
28
26
29
27
- def test_execute ():
30
+ def test_execute (db ):
31
+
28
32
q = 'SELECT name FROM sqlite_master'
29
33
db .execute (q )
30
34
@@ -35,7 +39,8 @@ def test_execute():
35
39
assert sql ['database_version' ]
36
40
37
41
38
- def test_invalid_syntax ():
42
+ def test_invalid_syntax (db ):
43
+ db = sqlite3 .connect (":memory:" )
39
44
q = 'some_query'
40
45
try :
41
46
db .execute (q )
You can’t perform that action at this time.
0 commit comments