Skip to content
This repository was archived by the owner on Mar 29, 2023. It is now read-only.

Commit 2ff42c3

Browse files
authored
ci: run tests with multiple versions of ibis (#42)
* ci: run tests with multiple versions of ibis * try different matrix var name * fix indentation * skip failing tests on 1.2 and 1.3 * sort imports * skip failing param tests * shrink matrix for older versions * isort * add constraints based on actual testing * lint
1 parent d515184 commit 2ff42c3

File tree

8 files changed

+83
-10
lines changed

8 files changed

+83
-10
lines changed

.github/workflows/main.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ jobs:
5050
fail-fast: false
5151
matrix:
5252
python_version: ["3.7", "3.8", "3.9"]
53+
ibis_version: ["github"]
54+
include:
55+
- python_version: "3.7"
56+
"ibis_version": "1.2.0"
57+
- python_version: "3.7"
58+
"ibis_version": "1.3.0"
59+
- python_version: "3.8"
60+
"ibis_version": "1.4.0"
61+
5362
steps:
5463

5564
- name: checkout
@@ -66,7 +75,9 @@ jobs:
6675
with:
6776
python-version: ${{ matrix.python-version }}
6877

69-
- name: install dependencies
78+
- name: install dependencies (ibis ${{ matrix.ibis_version }})
79+
env:
80+
IBIS_VERSION: ${{ matrix.ibis_version }}
7081
run: ./ci/install_deps.sh
7182

7283
- name: run tests

.github/workflows/system-tests-pr.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
python_version: ["3.7", "3.8", "3.9"]
21+
ibis_version: ["github"]
22+
include:
23+
- python_version: "3.7"
24+
"ibis_version": "1.2.0"
25+
- python_version: "3.7"
26+
"ibis_version": "1.3.0"
27+
- python_version: "3.8"
28+
"ibis_version": "1.4.0"
29+
2130
steps:
2231
- name: checkout
2332
uses: actions/checkout@v2
@@ -35,7 +44,9 @@ jobs:
3544
repository: ibis-project/ibis
3645
path: ibis
3746

38-
- name: install dependencies
47+
- name: install dependencies (ibis ${{ matrix.ibis_version }})
48+
env:
49+
IBIS_VERSION: ${{ matrix.ibis_version }}
3950
run: ./ci/install_deps.sh
4051

4152
- name: set up bigquery credentials

.github/workflows/system-tests.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
python_version: ["3.7", "3.8", "3.9"]
19+
ibis_version: ["github"]
20+
include:
21+
- python_version: "3.7"
22+
"ibis_version": "1.2.0"
23+
- python_version: "3.7"
24+
"ibis_version": "1.3.0"
25+
- python_version: "3.8"
26+
"ibis_version": "1.4.0"
27+
1928
steps:
2029
- name: checkout
2130
uses: actions/checkout@v2
@@ -31,7 +40,9 @@ jobs:
3140
repository: ibis-project/ibis
3241
path: ibis
3342

34-
- name: install dependencies
43+
- name: install dependencies (ibis ${{ matrix.ibis_version }})
44+
env:
45+
IBIS_VERSION: ${{ matrix.ibis_version }}
3546
run: ./ci/install_deps.sh
3647

3748
- name: set up bigquery credentials

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Usage
3333
Connecting to BigQuery
3434
^^^^^^^^^^^^^^^^^^^^^^
3535

36-
Recommended usage:
36+
Recommended usage (Ibis 2.x, only [not yet released]):
3737

3838
.. code-block:: python
3939

ci/install_deps.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33
set -e
44
set -x
55

6-
# See https://github.com/pypa/pip/issues/7953
7-
echo "import site
6+
python -m pip install --upgrade pip
7+
8+
if [ "$IBIS_VERSION" = "github" ] ; then
9+
# See https://github.com/pypa/pip/issues/7953
10+
echo "
11+
import site
812
import sys
913
site.ENABLE_USER_SITE = '--user' in sys.argv[1:]
1014
$(cat ./ibis/setup.py)" > ./ibis/setup.py
1115

12-
python -m pip install --upgrade pip
13-
python -m pip install --user -e ./ibis
16+
python -m pip install --user -e ./ibis
17+
else
18+
python -m pip install --user ibis-framework=="$IBIS_VERSION"
19+
fi
20+
1421
python -m pip install --user -e .
1522
python -m pip install --user pytest

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
packages=setuptools.find_packages(),
4242
python_requires=">=3.7",
4343
install_requires=[
44-
"ibis-framework", # TODO require ibis 2.0 when it's released
44+
# TODO require ibis 2.0 when it's released
45+
"ibis-framework >= 1.2.0,<3.0.0dev",
4546
"google-cloud-bigquery >=1.12.0,<3.0.0dev",
4647
"google-cloud-bigquery-storage >=1.0.0,<3.0.0dev",
4748
"pyarrow >=1.0.0,<4.0.0dev",

tests/system/test_client.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import ibis.expr.datatypes as dt
77
import ibis.expr.types as ir
88
import numpy as np
9+
import packaging
910
import pandas as pd
1011
import pandas.testing as tm
1112
import pytest
@@ -15,7 +16,8 @@
1516
import ibis_bigquery
1617
from ibis_bigquery.client import bigquery_param
1718

18-
pytestmark = pytest.mark.bigquery
19+
IBIS_VERSION = packaging.version.Version(ibis.__version__)
20+
IBIS_1_4_VERSION = packaging.version.Version("1.4.0")
1921

2022

2123
def test_table(alltypes):
@@ -236,6 +238,8 @@ def test_subquery_scalar_params(alltypes, project_id):
236238

237239

238240
def test_scalar_param_string(alltypes, df):
241+
if IBIS_VERSION < IBIS_1_4_VERSION:
242+
pytest.skip("requires ibis 1.4+")
239243
param = ibis.param('string')
240244
expr = alltypes[alltypes.string_col == param]
241245

@@ -254,6 +258,8 @@ def test_scalar_param_string(alltypes, df):
254258

255259

256260
def test_scalar_param_int64(alltypes, df):
261+
if IBIS_VERSION < IBIS_1_4_VERSION:
262+
pytest.skip("requires ibis 1.4+")
257263
param = ibis.param('int64')
258264
expr = alltypes[alltypes.string_col.cast('int64') == param]
259265

@@ -272,6 +278,8 @@ def test_scalar_param_int64(alltypes, df):
272278

273279

274280
def test_scalar_param_double(alltypes, df):
281+
if IBIS_VERSION < IBIS_1_4_VERSION:
282+
pytest.skip("requires ibis 1.4+")
275283
param = ibis.param('double')
276284
expr = alltypes[alltypes.string_col.cast('int64').cast('double') == param]
277285

@@ -290,6 +298,8 @@ def test_scalar_param_double(alltypes, df):
290298

291299

292300
def test_scalar_param_boolean(alltypes, df):
301+
if IBIS_VERSION < IBIS_1_4_VERSION:
302+
pytest.skip("requires ibis 1.4+")
293303
param = ibis.param('boolean')
294304
expr = alltypes[(alltypes.string_col.cast('int64') == 0) == param]
295305

@@ -316,6 +326,8 @@ def test_scalar_param_boolean(alltypes, df):
316326
],
317327
)
318328
def test_scalar_param_timestamp(alltypes, df, timestamp_value):
329+
if IBIS_VERSION < IBIS_1_4_VERSION:
330+
pytest.skip("requires ibis 1.4+")
319331
param = ibis.param('timestamp')
320332
expr = alltypes[alltypes.timestamp_col <= param][['timestamp_col']]
321333

@@ -338,6 +350,8 @@ def test_scalar_param_timestamp(alltypes, df, timestamp_value):
338350
['2009-01-20', datetime.date(2009, 1, 20), datetime.datetime(2009, 1, 20)],
339351
)
340352
def test_scalar_param_date(alltypes, df, date_value):
353+
if IBIS_VERSION < IBIS_1_4_VERSION:
354+
pytest.skip("requires ibis 1.4+")
341355
param = ibis.param('date')
342356
expr = alltypes[alltypes.timestamp_col.cast('date') <= param]
343357

@@ -356,6 +370,8 @@ def test_scalar_param_date(alltypes, df, date_value):
356370

357371

358372
def test_scalar_param_array(alltypes, df):
373+
if IBIS_VERSION < IBIS_1_4_VERSION:
374+
pytest.skip("requires ibis 1.4+")
359375
param = ibis.param('array<double>')
360376
expr = alltypes.sort_by('id').limit(1).double_col.collect() + param
361377
result = expr.execute(params={param: [1]})
@@ -368,6 +384,8 @@ def test_scalar_param_array(alltypes, df):
368384

369385

370386
def test_scalar_param_struct(client):
387+
if IBIS_VERSION < IBIS_1_4_VERSION:
388+
pytest.skip("requires ibis 1.4+")
371389
struct_type = dt.Struct.from_tuples([('x', dt.int64), ('y', dt.string)])
372390
param = ibis.param(struct_type)
373391
value = collections.OrderedDict([('x', 1), ('y', 'foobar')])
@@ -376,6 +394,8 @@ def test_scalar_param_struct(client):
376394

377395

378396
def test_scalar_param_nested(client):
397+
if IBIS_VERSION < IBIS_1_4_VERSION:
398+
pytest.skip("requires ibis 1.4+")
379399
param = ibis.param('struct<x: array<struct<y: array<double>>>>')
380400
value = collections.OrderedDict(
381401
[('x', [collections.OrderedDict([('y', [1.0, 2.0, 3.0])])])]
@@ -467,6 +487,8 @@ def test_parted_column_rename(parted_alltypes):
467487

468488

469489
def test_scalar_param_partition_time(parted_alltypes):
490+
if IBIS_VERSION < IBIS_1_4_VERSION:
491+
pytest.skip("requires ibis 1.4+")
470492
assert 'PARTITIONTIME' in parted_alltypes.columns
471493
assert 'PARTITIONTIME' in parted_alltypes.schema()
472494
param = ibis.param('timestamp').name('time_param')

tests/unit/test_compiler.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
import ibis
44
import ibis.expr.datatypes as dt
55
import ibis.expr.operations as ops
6+
import packaging.version
67
import pandas as pd
78
import pytest
89
from ibis.expr.types import TableExpr
910

1011
import ibis_bigquery
1112

13+
IBIS_VERSION = packaging.version.Version(ibis.__version__)
14+
IBIS_1_4_VERSION = packaging.version.Version("1.4.0")
15+
1216

1317
@pytest.mark.parametrize(
1418
('case', 'expected', 'dtype'),
@@ -103,6 +107,8 @@ def test_day_of_week(case, expected, dtype, strftime_func):
103107
],
104108
)
105109
def test_hash(case, expected, dtype):
110+
if IBIS_VERSION < IBIS_1_4_VERSION:
111+
pytest.skip("requires ibis 1.4+")
106112
string_var = ibis.literal(case, type=dtype)
107113
expr = string_var.hash(how="farm_fingerprint")
108114
result = ibis_bigquery.compile(expr)
@@ -123,6 +129,8 @@ def test_hash(case, expected, dtype):
123129
],
124130
)
125131
def test_hashbytes(case, expected, how, dtype):
132+
if IBIS_VERSION < IBIS_1_4_VERSION:
133+
pytest.skip("requires ibis 1.4+")
126134
var = ibis.literal(case, type=dtype)
127135
expr = var.hashbytes(how=how)
128136
result = ibis_bigquery.compile(expr)
@@ -158,6 +166,8 @@ def test_literal_timestamp_or_time(case, expected, dtype):
158166

159167

160168
def test_projection_fusion_only_peeks_at_immediate_parent():
169+
if IBIS_VERSION < IBIS_1_4_VERSION:
170+
pytest.skip("requires ibis 1.4+")
161171
schema = [
162172
('file_date', 'timestamp'),
163173
('PARTITIONTIME', 'date'),

0 commit comments

Comments
 (0)