# 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
    session.add(user2)
    # If the test does not raised an error, it is passing


@pytest.mark.skipif(not is_postgres_running(), reason=SKIP_REASON)
def test_connection_proxy(connection):
    assert isinstance(connection, psycopg2.ConnectionWrapper)

    # Test that connection properties are proxied by
    # ContextManagerConnectionWrapper
    assert connection.closed == 0


def _test_register_type(connection):
    assert not connection.string_types

    test_type = pg_extensions.UNICODE
    pg_extensions.register_type(test_type, connection)

    assert connection.string_types
    for string_type in connection.string_types.values():
        assert string_type is test_type


@pytest.mark.skipif(not is_postgres_running(), reason=SKIP_REASON)
def test_register_type_for_wrapped_connection(connection):
    _test_register_type(connection)


@pytest.mark.skipif(not is_postgres_running(), reason=SKIP_REASON)

# 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

    session.add(user2)
    # If the test does not raised an error, it is passing


@pytest.mark.skipif(not is_postgres_running(), reason=SKIP_REASON)
def test_connection_proxy(connection):
    assert isinstance(connection, psycopg2.ConnectionWrapper)

    # Test that connection properties are proxied by
    # ContextManagerConnectionWrapper
    assert connection.closed == 0


def _test_register_type(connection):
    assert not connection.string_types

    test_type = pg_extensions.UNICODE
    pg_extensions.register_type(test_type, connection)

    assert connection.string_types
    for string_type in connection.string_types.values():
        assert string_type is test_type


@pytest.mark.skipif(not is_postgres_running(), reason=SKIP_REASON)
def test_register_type_for_wrapped_connection(connection):
    _test_register_type(connection)


@pytest.mark.skipif(not is_postgres_running(), reason=SKIP_REASON)

def test_register_type_for_raw_connection(connection):