Skip to content

Commit 39f2ef8

Browse files
committed
Patch pg8000 tests only once per module
1 parent 5694ce8 commit 39f2ef8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/ext/pg8000/test_pg8000.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,25 @@
99
from aws_xray_sdk.ext.pg8000 import unpatch
1010

1111

12+
@pytest.fixture(scope='module', autouse=True)
13+
def patch_module():
14+
patch(('pg8000',))
15+
yield
16+
unpatch()
17+
18+
1219
@pytest.fixture(autouse=True)
1320
def construct_ctx():
1421
"""
1522
Clean up context storage on each test run and begin a segment
1623
so that later subsegment can be attached. After each test run
1724
it cleans up context storage again.
1825
"""
19-
patch(('pg8000',))
2026
xray_recorder.configure(service='test', sampling=False, context=Context())
2127
xray_recorder.clear_trace_entities()
2228
xray_recorder.begin_segment('name')
2329
yield
2430
xray_recorder.clear_trace_entities()
25-
unpatch()
2631

2732

2833
def test_execute_dsn_kwargs():

0 commit comments

Comments
 (0)