Skip to content

Commit ca7267e

Browse files
author
Jim Fulton
authored
test: Updated for changes in BigQuery schema field reprs (#213)
1 parent a567c9f commit ca7267e

File tree

5 files changed

+24
-98
lines changed

5 files changed

+24
-98
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
docker:
22
image: gcr.io/repo-automation-bots/owlbot-python:latest
3-
digest: sha256:99d90d097e4a4710cc8658ee0b5b963f4426d0e424819787c3ac1405c9a26719
3+
digest: sha256:5ff7446edeaede81c3ed58b23a4e76a5403fba1350ce28478045657303b6479d

packages/sqlalchemy-bigquery/.kokoro/docker/docs/Dockerfile

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ RUN apt-get update \
4040
libssl-dev \
4141
libsqlite3-dev \
4242
portaudio19-dev \
43+
python3-distutils \
4344
redis-server \
4445
software-properties-common \
4546
ssh \
@@ -59,40 +60,8 @@ RUN apt-get update \
5960
&& rm -rf /var/lib/apt/lists/* \
6061
&& rm -f /var/cache/apt/archives/*.deb
6162

62-
63-
COPY fetch_gpg_keys.sh /tmp
64-
# Install the desired versions of Python.
65-
RUN set -ex \
66-
&& export GNUPGHOME="$(mktemp -d)" \
67-
&& echo "disable-ipv6" >> "${GNUPGHOME}/dirmngr.conf" \
68-
&& /tmp/fetch_gpg_keys.sh \
69-
&& for PYTHON_VERSION in 3.7.8 3.8.5; do \
70-
wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
71-
&& wget --no-check-certificate -O python-${PYTHON_VERSION}.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
72-
&& gpg --batch --verify python-${PYTHON_VERSION}.tar.xz.asc python-${PYTHON_VERSION}.tar.xz \
73-
&& rm -r python-${PYTHON_VERSION}.tar.xz.asc \
74-
&& mkdir -p /usr/src/python-${PYTHON_VERSION} \
75-
&& tar -xJC /usr/src/python-${PYTHON_VERSION} --strip-components=1 -f python-${PYTHON_VERSION}.tar.xz \
76-
&& rm python-${PYTHON_VERSION}.tar.xz \
77-
&& cd /usr/src/python-${PYTHON_VERSION} \
78-
&& ./configure \
79-
--enable-shared \
80-
# This works only on Python 2.7 and throws a warning on every other
81-
# version, but seems otherwise harmless.
82-
--enable-unicode=ucs4 \
83-
--with-system-ffi \
84-
--without-ensurepip \
85-
&& make -j$(nproc) \
86-
&& make install \
87-
&& ldconfig \
88-
; done \
89-
&& rm -rf "${GNUPGHOME}" \
90-
&& rm -rf /usr/src/python* \
91-
&& rm -rf ~/.cache/
92-
9363
RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
94-
&& python3.7 /tmp/get-pip.py \
9564
&& python3.8 /tmp/get-pip.py \
9665
&& rm /tmp/get-pip.py
9766

98-
CMD ["python3.7"]
67+
CMD ["python3.8"]

packages/sqlalchemy-bigquery/.kokoro/docker/docs/fetch_gpg_keys.sh

Lines changed: 0 additions & 45 deletions
This file was deleted.

packages/sqlalchemy-bigquery/.kokoro/test-samples-impl.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ set -eo pipefail
2020
# Enables `**` to include files nested inside sub-folders
2121
shopt -s globstar
2222

23-
# Exit early if samples directory doesn't exist
24-
if [ ! -d "./samples" ]; then
25-
echo "No tests run. `./samples` not found"
23+
# Exit early if samples don't exist
24+
if ! find samples -name 'requirements.txt' | grep -q .; then
25+
echo "No tests run. './samples/**/requirements.txt' not found"
2626
exit 0
2727
fi
2828

packages/sqlalchemy-bigquery/tests/system/test_alembic.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ def test_alembic_scenario(alembic_table):
8282
Column("description", String(200)),
8383
)
8484
assert alembic_table("account", "schema") == [
85-
"SchemaField('id', 'INTEGER', 'REQUIRED')",
86-
"SchemaField('name', 'STRING(50)', 'REQUIRED', 'The name')",
87-
"SchemaField('description', 'STRING(200)', 'NULLABLE')",
85+
"SchemaField('id', 'INTEGER', 'REQUIRED', None, (), ())",
86+
"SchemaField('name', 'STRING(50)', 'REQUIRED', 'The name', (), ())",
87+
"SchemaField('description', 'STRING(200)', 'NULLABLE', None, (), ())",
8888
]
8989

9090
op.bulk_insert(
@@ -107,10 +107,11 @@ def test_alembic_scenario(alembic_table):
107107
)
108108

109109
assert alembic_table("account", "schema") == [
110-
"SchemaField('id', 'INTEGER', 'REQUIRED')",
111-
"SchemaField('name', 'STRING(50)', 'REQUIRED', 'The name')",
112-
"SchemaField('description', 'STRING(200)', 'NULLABLE')",
113-
"SchemaField('last_transaction_date', 'DATETIME', 'NULLABLE', 'when updated')",
110+
"SchemaField('id', 'INTEGER', 'REQUIRED', None, (), ())",
111+
"SchemaField('name', 'STRING(50)', 'REQUIRED', 'The name', (), ())",
112+
"SchemaField('description', 'STRING(200)', 'NULLABLE', None, (), ())",
113+
"SchemaField('last_transaction_date', 'DATETIME', 'NULLABLE', 'when updated'"
114+
", (), ())",
114115
]
115116

116117
op.create_table(
@@ -126,8 +127,8 @@ def test_alembic_scenario(alembic_table):
126127

127128
op.drop_column("account_w_comment", "description")
128129
assert alembic_table("account_w_comment", "schema") == [
129-
"SchemaField('id', 'INTEGER', 'REQUIRED')",
130-
"SchemaField('name', 'STRING(50)', 'REQUIRED', 'The name')",
130+
"SchemaField('id', 'INTEGER', 'REQUIRED', None, (), ())",
131+
"SchemaField('name', 'STRING(50)', 'REQUIRED', 'The name', (), ())",
131132
]
132133

133134
op.drop_table("account_w_comment")
@@ -136,10 +137,11 @@ def test_alembic_scenario(alembic_table):
136137
op.rename_table("account", "accounts")
137138
assert alembic_table("account") is None
138139
assert alembic_table("accounts", "schema") == [
139-
"SchemaField('id', 'INTEGER', 'REQUIRED')",
140-
"SchemaField('name', 'STRING(50)', 'REQUIRED', 'The name')",
141-
"SchemaField('description', 'STRING(200)', 'NULLABLE')",
142-
"SchemaField('last_transaction_date', 'DATETIME', 'NULLABLE', 'when updated')",
140+
"SchemaField('id', 'INTEGER', 'REQUIRED', None, (), ())",
141+
"SchemaField('name', 'STRING(50)', 'REQUIRED', 'The name', (), ())",
142+
"SchemaField('description', 'STRING(200)', 'NULLABLE', None, (), ())",
143+
"SchemaField('last_transaction_date', 'DATETIME', 'NULLABLE', 'when updated'"
144+
", (), ())",
143145
]
144146
op.drop_table("accounts")
145147
assert alembic_table("accounts") is None
@@ -159,9 +161,9 @@ def test_alembic_scenario(alembic_table):
159161
# nullable:
160162
op.alter_column("transactions", "amount", True)
161163
assert alembic_table("transactions", "schema") == [
162-
"SchemaField('account', 'INTEGER', 'REQUIRED')",
163-
"SchemaField('transaction_time', 'DATETIME', 'REQUIRED')",
164-
"SchemaField('amount', 'NUMERIC(11, 2)', 'NULLABLE')",
164+
"SchemaField('account', 'INTEGER', 'REQUIRED', None, (), ())",
165+
"SchemaField('transaction_time', 'DATETIME', 'REQUIRED', None, (), ())",
166+
"SchemaField('amount', 'NUMERIC(11, 2)', 'NULLABLE', None, (), ())",
165167
]
166168

167169
op.create_table_comment("transactions", "Transaction log")

0 commit comments

Comments
 (0)