Skip to content

Commit

Permalink
Patch pg8000 tests only once per module
Browse files Browse the repository at this point in the history
  • Loading branch information
hasier committed Jan 4, 2019
1 parent 5694ce8 commit 39f2ef8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/ext/pg8000/test_pg8000.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,25 @@
from aws_xray_sdk.ext.pg8000 import unpatch


@pytest.fixture(scope='module', autouse=True)
def patch_module():
patch(('pg8000',))
yield
unpatch()


@pytest.fixture(autouse=True)
def construct_ctx():
"""
Clean up context storage on each test run and begin a segment
so that later subsegment can be attached. After each test run
it cleans up context storage again.
"""
patch(('pg8000',))
xray_recorder.configure(service='test', sampling=False, context=Context())
xray_recorder.clear_trace_entities()
xray_recorder.begin_segment('name')
yield
xray_recorder.clear_trace_entities()
unpatch()


def test_execute_dsn_kwargs():
Expand Down

0 comments on commit 39f2ef8

Please sign in to comment.