Skip to content
This repository was archived by the owner on Mar 13, 2026. It is now read-only.
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
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,19 @@ with engine.begin() as connection:
```
Connectionless way of use is also deprecated since SQLAlchemy 2.0 and soon will be removed (see in [SQLAlchemy docs](https://docs.sqlalchemy.org/en/14/core/connections.html#connectionless-execution-implicit-execution)).

Running tests
------------
Spanner dialect includes a compliance, migration and unit test suite. To run the tests the `nox` package commands can be used:
```
# Run the whole suite
$ nox

# Run a particular test session
$ nox -s migration_test
```
**Running tests on Spanner emulator**
The dialect test suite can be runned on [Spanner emulator](https://cloud.google.com/spanner/docs/emulator). Several tests, relating to `NULL` values of data types, are skipped when executed on emulator.

Contributing
------------

Expand Down
39 changes: 36 additions & 3 deletions test/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import decimal
import operator
import os
import pytest
import decimal
import pytz
from unittest import mock

Expand Down Expand Up @@ -329,7 +330,17 @@ class DateTest(DateFixtureTest, _DateTest):
and maintain DRY concept just inherit the class to run tests successfully.
"""

pass
@pytest.mark.skipif(
bool(os.environ.get("SPANNER_EMULATOR_HOST")), reason="Skipped on emulator"
Comment thread
IlyaFaer marked this conversation as resolved.
)
def test_null_bound_comparison(self):
super().test_null_bound_comparison()

@pytest.mark.skipif(
bool(os.environ.get("SPANNER_EMULATOR_HOST")), reason="Skipped on emulator"
)
def test_null(self):
super().test_null()


class DateTimeMicrosecondsTest(_DateTimeMicrosecondsTest, DateTest):
Expand All @@ -349,6 +360,18 @@ def test_round_trip(self):
eq_(row[0].rfc3339(), compare)
assert isinstance(row[0], DatetimeWithNanoseconds)

@pytest.mark.skipif(
bool(os.environ.get("SPANNER_EMULATOR_HOST")), reason="Skipped on emulator"
)
def test_null_bound_comparison(self):
super().test_null_bound_comparison()

@pytest.mark.skipif(
bool(os.environ.get("SPANNER_EMULATOR_HOST")), reason="Skipped on emulator"
)
def test_null(self):
super().test_null()


class DateTimeTest(_DateTimeTest, DateTimeMicrosecondsTest):
"""
Expand All @@ -359,7 +382,17 @@ class DateTimeTest(_DateTimeTest, DateTimeMicrosecondsTest):
tests successfully.
"""

pass
@pytest.mark.skipif(
bool(os.environ.get("SPANNER_EMULATOR_HOST")), reason="Skipped on emulator"
)
def test_null_bound_comparison(self):
super().test_null_bound_comparison()

@pytest.mark.skipif(
bool(os.environ.get("SPANNER_EMULATOR_HOST")), reason="Skipped on emulator"
)
def test_null(self):
super().test_null()


@pytest.mark.skip("Spanner doesn't support Time data type.")
Expand Down