File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323from google .cloud .sqlcommenter .opencensus import get_opencensus_values
2424from google .cloud .sqlcommenter .opentelemetry import get_opentelemetry_values
2525
26-
2726logger = logging .getLogger (__name__ )
2827
28+
2929# This integration extends psycopg2.extensions.cursor
3030# by implementing a custom execute method.
3131#
Original file line number Diff line number Diff line change 1717# This integration implements the before_cursor_execute hook factory as per:
1818# https://kite.com/python/docs/sqlalchemy.events.ConnectionEvents.before_execute
1919from __future__ import absolute_import
20+
2021import logging
2122
2223import sqlalchemy
2526from google .cloud .sqlcommenter .opencensus import get_opencensus_values
2627from google .cloud .sqlcommenter .opentelemetry import get_opentelemetry_values
2728
28-
2929logger = logging .getLogger (__name__ )
3030
31+
3132def BeforeExecuteFactory (
3233 with_framework = True , with_controller = True , with_route = True ,
3334 with_opencensus = False , with_opentelemetry = False , with_db_driver = False ,
Original file line number Diff line number Diff line change 1818
1919from setuptools import find_packages , setup
2020
21+
2122def read_file (filename ):
2223 with open (os .path .join (os .path .dirname (__file__ ), filename )) as file :
2324 return file .read ()
2425
26+
2527setup (
2628 name = 'google-cloud-sqlcommenter' ,
2729 version = '1.0.0' ,
Original file line number Diff line number Diff line change @@ -30,5 +30,5 @@ def skipIfPy2(testcase):
3030 sys .version_info .major == 2 , "Feature only support in python3+"
3131 )(testcase )
3232
33- __all__ = ["mock" ]
3433
34+ __all__ = ["mock" ]
Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ def test_opentelemetry(self):
8888 "tracestate='some_key%%3Dsome_value'*/" ,
8989 with_opentelemetry = True ,
9090 )
91-
91+
9292 def test_both_opentelemetry_and_opencensus_warn (self ):
9393 with mock .patch (
9494 "google.cloud.sqlcommenter.psycopg2.extension.logger"
@@ -101,6 +101,7 @@ def test_both_opentelemetry_and_opencensus_warn(self):
101101 )
102102 self .assertEqual (len (logger_mock .warning .mock_calls ), 1 )
103103
104+
104105class FlaskTests (Psycopg2TestCase ):
105106 flask_info = {
106107 'framework' : 'flask' ,
Original file line number Diff line number Diff line change 1515# limitations under the License.
1616
1717from unittest import TestCase
18- from unittest .case import skip , skipIf
1918
2019import sqlalchemy
2120from google .cloud .sqlcommenter .sqlalchemy .executor import BeforeExecuteFactory
@@ -127,4 +126,3 @@ def test_route_disabled(self, get_info):
127126 "SELECT 1; /*controller='c',framework='flask'*/" ,
128127 with_route = False ,
129128 )
130-
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ commands =
2828skip_install = True
2929deps =
3030 flake8
31- isort
31+ isort < 5
3232commands =
3333 flake8
3434 isort --recursive --check-only --diff
You can’t perform that action at this time.
0 commit comments