# Path: opentracing_instrumentation/client_hooks/sqlalchemy.py
# class SQLAlchemyPatcher(Patcher):
#     def _install_patches(self):
#     def _reset_patches(self):
#     def before_cursor_execute(conn, cursor, statement, parameters, context,
#                               executemany):
#     def after_cursor_execute(conn, cursor, statement, parameters, context,
#                              executemany):
# 
# Path: tests/opentracing_instrumentation/sql_common.py
# class User(object):
#     def __init__(self, name, fullname, password):


import pytest
import sqlalchemy.engine.url
from opentracing.ext import tags
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from opentracing_instrumentation.client_hooks import (
    sqlalchemy as sqlalchemy_hooks
)
from .sql_common import metadata, User



@pytest.fixture
def session():
    Session = sessionmaker()
    engine = create_engine("sqlite://")
    Session.configure(bind=engine)
    metadata.create_all(engine)
    try:
        yield Session()
    except:
        pass


@pytest.fixture(autouse=True, scope='module')
def patch_sqlalchemy():
    sqlalchemy_hooks.install_patches()
    try:
        yield
    finally:

# Path: opentracing_instrumentation/client_hooks/sqlalchemy.py
# class SQLAlchemyPatcher(Patcher):
#     def _install_patches(self):
#     def _reset_patches(self):
#     def before_cursor_execute(conn, cursor, statement, parameters, context,
#                               executemany):
#     def after_cursor_execute(conn, cursor, statement, parameters, context,
#                              executemany):
# 
# Path: tests/opentracing_instrumentation/sql_common.py
# class User(object):
#     def __init__(self, name, fullname, password):


# Path: tests/opentracing_instrumentation/test_sqlalchemy.py
import pytest
import sqlalchemy.engine.url
from opentracing.ext import tags
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from opentracing_instrumentation.client_hooks import (
    sqlalchemy as sqlalchemy_hooks
)
from .sql_common import metadata, User




@pytest.fixture
def session():
    Session = sessionmaker()
    engine = create_engine("sqlite://")
    Session.configure(bind=engine)
    metadata.create_all(engine)
    try:
        yield Session()
    except:
        pass


@pytest.fixture(autouse=True, scope='module')
def patch_sqlalchemy():
    sqlalchemy_hooks.install_patches()
    try:
        yield
    finally:

        sqlalchemy_hooks.reset_patches()