Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions django_spanner/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd

import spanner_dbapi as Database
from django.db.backends.base.base import BaseDatabaseWrapper
from google.cloud import spanner_v1 as spanner
from google.cloud import spanner_v1 as spanner, spanner_dbapi as Database

from .client import DatabaseClient
from .creation import DatabaseCreation
Expand Down
6 changes: 5 additions & 1 deletion django_spanner/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
from django.db.utils import DatabaseError
from django.utils import timezone
from django.utils.duration import duration_microseconds
from spanner_dbapi.parse_utils import DateStr, TimestampStr, escape_name
from google.cloud.spanner_dbapi.parse_utils import (
DateStr,
TimestampStr,
escape_name,
)


class DatabaseOperations(BaseDatabaseOperations):
Expand Down
Empty file added google/__init__.py
Empty file.
Empty file added google/cloud/__init__.py
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def connect(


__all__ = [
"Connection",
"DatabaseError",
"DataError",
"Error",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
BLACK_PATHS = [
"django_spanner",
"docs",
"spanner_dbapi",
"google",
"tests",
"noxfile.py",
"setup.py",
Expand All @@ -34,7 +34,7 @@ def lint(session):
"""
session.install("flake8", BLACK_VERSION)
session.run("black", "--check", *BLACK_PATHS)
session.run("flake8", "django_spanner", "spanner_dbapi", "tests")
session.run("flake8", "django_spanner", "google", "tests")


@nox.session(python="3.8")
Expand Down Expand Up @@ -70,7 +70,7 @@ def default(session):
"py.test",
"--quiet",
"--cov=django_spanner",
"--cov=spanner_dbapi",
"--cov=google.cloud",
"--cov=tests.spanner_dbapi",
"--cov-append",
"--cov-config=.coveragerc",
Expand Down Expand Up @@ -126,7 +126,7 @@ def cover(session):
test runs (not system test runs), and then erases coverage data.
"""
session.install("coverage", "pytest-cov")
session.run("coverage", "report", "--show-missing", "--fail-under=20")
session.run("coverage", "report", "--show-missing", "--fail-under=40")
session.run("coverage", "erase")


Expand Down
9 changes: 6 additions & 3 deletions tests/spanner_dbapi/test_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import google.auth.credentials
from google.api_core.gapic_v1.client_info import ClientInfo
from spanner_dbapi import connect, Connection
from google.cloud.spanner_dbapi import connect, Connection


def _make_credentials():
Expand All @@ -30,9 +30,12 @@ def test_connect(self):
CREDENTIALS = _make_credentials()
CLIENT_INFO = ClientInfo(user_agent=USER_AGENT)

with mock.patch("spanner_dbapi.spanner_v1.Client") as client_mock:
with mock.patch(
"google.cloud.spanner_dbapi.spanner_v1.Client"
) as client_mock:
with mock.patch(
"spanner_dbapi.google_client_info", return_value=CLIENT_INFO
"google.cloud.spanner_dbapi.google_client_info",
return_value=CLIENT_INFO,
) as client_info_mock:

connection = connect(
Expand Down
2 changes: 1 addition & 1 deletion tests/spanner_dbapi/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import unittest
from unittest import mock

from spanner_dbapi import connect, InterfaceError
from google.cloud.spanner_dbapi import connect, InterfaceError


class TestConnection(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/spanner_dbapi/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import unittest
from unittest import mock

from spanner_dbapi import connect, InterfaceError
from google.cloud.spanner_dbapi import connect, InterfaceError


class TestCursor(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/spanner_dbapi/test_globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from unittest import TestCase

from spanner_dbapi import apilevel, paramstyle, threadsafety
from google.cloud.spanner_dbapi import apilevel, paramstyle, threadsafety


class DBAPIGlobalsTests(TestCase):
Expand Down
6 changes: 3 additions & 3 deletions tests/spanner_dbapi/test_parse_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from unittest import TestCase

from google.cloud.spanner_v1 import param_types
from spanner_dbapi.exceptions import Error, ProgrammingError
from spanner_dbapi.parse_utils import (
from google.cloud.spanner_dbapi.exceptions import Error, ProgrammingError
from google.cloud.spanner_dbapi.parse_utils import (
STMT_DDL,
STMT_NON_UPDATING,
DateStr,
Expand All @@ -24,7 +24,7 @@
sql_pyformat_args_to_spanner,
strip_backticks,
)
from spanner_dbapi.utils import backtick_unicode
from google.cloud.spanner_dbapi.utils import backtick_unicode


class ParseUtilsTests(TestCase):
Expand Down
4 changes: 2 additions & 2 deletions tests/spanner_dbapi/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from unittest import TestCase

from spanner_dbapi.exceptions import ProgrammingError
from spanner_dbapi.parser import (
from google.cloud.spanner_dbapi.exceptions import ProgrammingError
from google.cloud.spanner_dbapi.parser import (
ARGS,
FUNC,
TERMINAL,
Expand Down
4 changes: 2 additions & 2 deletions tests/spanner_dbapi/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
import datetime
from unittest import TestCase

from spanner_dbapi.types import (
from google.cloud.spanner_dbapi.types import (
Date,
DateFromTicks,
Time,
TimeFromTicks,
Timestamp,
TimestampFromTicks,
)
from spanner_dbapi.utils import PeekIterator
from google.cloud.spanner_dbapi.utils import PeekIterator

tzUTC = 0 # 0 hours offset from UTC

Expand Down
2 changes: 1 addition & 1 deletion tests/spanner_dbapi/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from unittest import TestCase

from spanner_dbapi.utils import PeekIterator
from google.cloud.spanner_dbapi.utils import PeekIterator


class UtilsTests(TestCase):
Expand Down
5 changes: 4 additions & 1 deletion tests/spanner_dbapi/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
from unittest import TestCase

from google.api_core.gapic_v1.client_info import ClientInfo
from spanner_dbapi.version import DEFAULT_USER_AGENT, google_client_info
from google.cloud.spanner_dbapi.version import (
DEFAULT_USER_AGENT,
google_client_info,
)

vers = sys.version_info

Expand Down