Skip to content

test: add back emulator test workflow #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
31 changes: 31 additions & 0 deletions .github/workflows/test_suite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
push:
branches:
- main
pull_request:
name: SQLAlchemy Spanner dialect
jobs:
tests:
runs-on: ubuntu-latest

services:
emulator-0:
image: gcr.io/cloud-spanner-emulator/emulator:latest
ports:
- 9010:9010

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install nox
run: python -m pip install nox
- name: Run SQLAlchemy tests
run: nox
env:
SPANNER_EMULATOR_HOST: localhost:9010
GOOGLE_CLOUD_PROJECT: appdev-soda-spanner-staging

4 changes: 2 additions & 2 deletions create_test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ def prep_instance():
# Filter out non "us" locations
configs = [config for config in configs if "-us-" in config.name]

instance_config = configs[0].name
instance_config = 'us-central1' if USE_EMULATOR else configs[0].name
create_time = str(int(time.time()))
unique_resource_id = '%s%d' % ('-', 1000 * time.time())
instance_id = "sqlalchemy-test" + unique_resource_id
instance_id = 'sqlalchemy-dialect-test' if USE_EMULATOR else "sqlalchemy-test" + unique_resource_id
labels = {"python-spanner-sqlalchemy-systest": "true", "created": create_time}

instance = CLIENT.instance(instance_id, instance_config, labels=labels)
Expand Down
7 changes: 6 additions & 1 deletion 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

import sqlalchemy
Expand Down Expand Up @@ -1008,6 +1009,10 @@ def test_text_roundtrip(self):
eq_(row, ("some text",))


@pytest.mark.skipif(
os.getenv("SPANNER_EMULATOR_HOST"),
reason="Numeric type isn't supported by emulator yet",
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these should fail. The latest release of the emulator does support NUMERIC. See googleapis/nodejs-spanner#1358 where we enabled the tests on Node.js.

class NumericTest(_NumericTest):
@emits_warning(r".*does \*not\* support Decimal objects natively")
def test_render_literal_numeric(self):
Expand Down