# Path: opentracing_instrumentation/client_hooks/psycopg2.py
# class Psycopg2CursorWrapper(CursorWrapper):
#     def execute(self, sql, params=NO_ARG):
#     def executemany(self, sql, seq_of_parameters):
# def install_patches():
#     def register_type(obj, conn_or_curs=None):
#     def quote_ident(string, scope):
# 
# Path: tests/opentracing_instrumentation/sql_common.py
# class User(object):
#     def __init__(self, name, fullname, password):


import mock
import psycopg2 as psycopg2_client
import pytest
from psycopg2 import extensions as pg_extensions, sql
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from opentracing_instrumentation.client_hooks import psycopg2
from .sql_common import metadata, User
    psycopg2.install_patches()
    factory_mock.assert_not_called()


@pytest.mark.skipif(not is_postgres_running(), reason=SKIP_REASON)
@pytest.mark.parametrize('method', ('execute', 'executemany', ))
@pytest.mark.parametrize('query', [
    # plain string
    '''SELECT %s;''',
    # bytes
    b'SELECT %s;',
    # Unicode
    u'''SELECT %s; -- привет''',
    # Composed
    sql.Composed([sql.SQL('''SELECT %s;''')]),
    # Identifier
    sql.SQL('''SELECT %s FROM {} LIMIT 1;''').format(
        sql.Identifier('pg_catalog', 'pg_database')
    ),
    # Literal
    sql.SQL('''SELECT {}''').format(sql.Literal('foobar')),
    # Placeholder
    sql.SQL('''SELECT {}''').format(sql.Placeholder())
], ids=('str', 'bytes', 'unicode', 'Composed',
        'Identifier', 'Literal', 'Placeholder'))
def test_execute_sql(tracer, engine, connection, method, query):

    # Check that executing with objects of ``sql.Composable`` subtypes doesn't
    # raise any exceptions.


# Path: opentracing_instrumentation/client_hooks/psycopg2.py
# class Psycopg2CursorWrapper(CursorWrapper):
#     def execute(self, sql, params=NO_ARG):
#     def executemany(self, sql, seq_of_parameters):
# def install_patches():
#     def register_type(obj, conn_or_curs=None):
#     def quote_ident(string, scope):
# 
# Path: tests/opentracing_instrumentation/sql_common.py
# class User(object):
#     def __init__(self, name, fullname, password):


# Path: tests/opentracing_instrumentation/test_postgres.py
import mock
import psycopg2 as psycopg2_client
import pytest
from psycopg2 import extensions as pg_extensions, sql
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from opentracing_instrumentation.client_hooks import psycopg2
from .sql_common import metadata, User

    psycopg2.install_patches()
    factory_mock.assert_not_called()


@pytest.mark.skipif(not is_postgres_running(), reason=SKIP_REASON)
@pytest.mark.parametrize('method', ('execute', 'executemany', ))
@pytest.mark.parametrize('query', [
    # plain string
    '''SELECT %s;''',
    # bytes
    b'SELECT %s;',
    # Unicode
    u'''SELECT %s; -- привет''',
    # Composed
    sql.Composed([sql.SQL('''SELECT %s;''')]),
    # Identifier
    sql.SQL('''SELECT %s FROM {} LIMIT 1;''').format(
        sql.Identifier('pg_catalog', 'pg_database')
    ),
    # Literal
    sql.SQL('''SELECT {}''').format(sql.Literal('foobar')),
    # Placeholder
    sql.SQL('''SELECT {}''').format(sql.Placeholder())
], ids=('str', 'bytes', 'unicode', 'Composed',
        'Identifier', 'Literal', 'Placeholder'))
def test_execute_sql(tracer, engine, connection, method, query):

    # Check that executing with objects of ``sql.Composable`` subtypes doesn't
    # raise any exceptions.


    metadata.create_all(engine)