Skip to content

Commit 31336cd

Browse files
committed
Lint changes
1 parent 5712294 commit 31336cd

6 files changed

Lines changed: 20 additions & 10 deletions

File tree

.github/workflows/unit-tests.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,8 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- run: 'echo "No build required" '
22+
23+
lint:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- run: 'echo "No build required" '

python/sqlcommenter-python/google/cloud/sqlcommenter/django/middleware.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import django
2121
from django.db import connections
22-
2322
from django.db.backends.utils import CursorDebugWrapper
2423
from google.cloud.sqlcommenter import add_sql_comment
2524
from google.cloud.sqlcommenter.opencensus import get_opencensus_values

python/sqlcommenter-python/tests/django/tests.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
import django
1818
from django.db import connection, connections
1919
from django.http import HttpRequest
20-
from django.test import TestCase, override_settings, modify_settings
20+
from django.test import TestCase, modify_settings, override_settings
2121
from django.urls import resolve, reverse
22-
from google.cloud.sqlcommenter.django.middleware import SqlCommenter, QueryWrapper
22+
from google.cloud.sqlcommenter.django.middleware import (
23+
QueryWrapper, SqlCommenter,
24+
)
2325

2426
from ..compat import mock
2527
from ..opencensus_mock import mock_opencensus_tracer
@@ -30,6 +32,8 @@
3032
# Adding the middleware twice in modify_settings
3133
# doesn't work. The middleware is only used once
3234
# if used in modify_settings
35+
36+
3337
class TestMiddleware:
3438
def __init__(self, get_response):
3539
self.get_response = get_response
@@ -38,10 +42,12 @@ def __call__(self, request):
3842
with connection.execute_wrapper(QueryWrapper(request)):
3943
return self.get_response(request)
4044

45+
4146
# Query log only active if DEBUG=True.
4247
@override_settings(DEBUG=True)
4348
class Tests(TestCase):
4449
databases = '__all__'
50+
4551
@staticmethod
4652
def get_request(path):
4753
request = HttpRequest()

python/sqlcommenter-python/tests/fastapi/app.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
from fastapi import FastAPI, status
44
from fastapi.responses import JSONResponse
5+
from google.cloud.sqlcommenter.fastapi import (
6+
SQLCommenterMiddleware, get_fastapi_info,
7+
)
58
from starlette.exceptions import HTTPException as StarletteHTTPException
69

7-
from google.cloud.sqlcommenter.fastapi import SQLCommenterMiddleware, get_fastapi_info
8-
910
app = FastAPI(title="SQLCommenter")
1011

1112
app.add_middleware(SQLCommenterMiddleware)

python/sqlcommenter-python/tests/fastapi/tests.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818

1919
import fastapi
2020
import pytest
21-
from starlette.testclient import TestClient
22-
2321
from google.cloud.sqlcommenter.fastapi import get_fastapi_info
22+
from starlette.testclient import TestClient
2423

2524
from .app import app
2625

python/sqlcommenter-python/tests/generic/test_add_sql_comment.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ def test_end_comment_escaping(self):
2727
self.assertEqual("Select 1 /*a='%%2A/abc'*/", add_sql_comment("Select 1", a='*/abc'))
2828

2929
def test_bytes(self):
30-
self.assertIn("Select 1 /*a='%%2A/abc'*/", add_sql_comment("Select 1",a=b'*/abc'))
30+
self.assertIn("Select 1 /*a='%%2A/abc'*/", add_sql_comment("Select 1", a=b'*/abc'))
3131

3232
def test_url_quoting(self):
33-
self.assertIn("Select 1 /*foo='bar%%2Cbaz'*/", add_sql_comment("Select 1",foo='bar,baz'))
33+
self.assertIn("Select 1 /*foo='bar%%2Cbaz'*/", add_sql_comment("Select 1", foo='bar,baz'))
3434

3535
def test_sql_with_semicolon(self):
36-
self.assertIn("Select 1 /*foo='bar%%2Cbaz'*/;", add_sql_comment("Select 1;",foo='bar,baz'))
36+
self.assertIn("Select 1 /*foo='bar%%2Cbaz'*/;", add_sql_comment("Select 1;", foo='bar,baz'))

0 commit comments

Comments
 (0)