2222
2323PSYCOPG_VERSION = tuple (map (int , psycopg2 .__version__ .split ()[0 ].split ('.' )))
2424TEST_PORT = str (POSTGRES_CONFIG ['port' ])
25-
26-
2725class PsycopgCore (object ):
2826
2927 # default service
@@ -126,7 +124,6 @@ def test_manual_wrap_extension_types(self):
126124 # TypeError: argument 2 must be a connection, cursor or None
127125 extras .register_default_json (conn )
128126
129-
130127 def test_manual_wrap_extension_adapt (self ):
131128 conn , _ = self ._get_conn_and_tracer ()
132129 # NOTE: this will crash if it doesn't work.
@@ -143,6 +140,17 @@ def test_manual_wrap_extension_adapt(self):
143140 binary = extensions .adapt (b'12345' )
144141 binary .prepare (conn )
145142
143+ @skipIf (PSYCOPG_VERSION < (2 , 7 ), 'quote_ident not available in psycopg2<2.7' )
144+ def test_manual_wrap_extension_quote_ident (self ):
145+ from ddtrace import patch_all
146+ patch_all ()
147+ from psycopg2 .extensions import quote_ident
148+
149+ # NOTE: this will crash if it doesn't work.
150+ # TypeError: argument 2 must be a connection or a cursor
151+ conn = psycopg2 .connect (** POSTGRES_CONFIG )
152+ quote_ident ('foo' , conn )
153+
146154 def test_connect_factory (self ):
147155 tracer = get_dummy_tracer ()
148156
@@ -214,9 +222,21 @@ def test_patch_unpatch(self):
214222 assert spans , spans
215223 eq_ (len (spans ), 1 )
216224
225+
217226def test_backwards_compatibilty_v3 ():
218227 tracer = get_dummy_tracer ()
219228 factory = connection_factory (tracer , service = "my-postgres-db" )
220229 conn = psycopg2 .connect (connection_factory = factory , ** POSTGRES_CONFIG )
221230 conn .cursor ().execute ("select 'blah'" )
222231
232+
233+ @skipIf (PSYCOPG_VERSION < (2 , 7 ), 'quote_ident not available in psycopg2<2.7' )
234+ def test_manual_wrap_extension_quote_ident_standalone ():
235+ from ddtrace import patch_all
236+ patch_all ()
237+ from psycopg2 .extensions import quote_ident
238+
239+ # NOTE: this will crash if it doesn't work.
240+ # TypeError: argument 2 must be a connection or a cursor
241+ conn = psycopg2 .connect (** POSTGRES_CONFIG )
242+ quote_ident ('foo' , conn )
0 commit comments