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

Commit

Permalink
ci: fix ibis version computation and update tests (#137)
Browse files Browse the repository at this point in the history
* ci: set fetch-depth in unit and system tests

* test: fix tests that now correctly produce the name of the expression
  • Loading branch information
cpcloud authored May 26, 2022
1 parent d2de30d commit dea960d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
with:
repository: ibis-project/ibis
path: ibis
fetch-depth: 0

- name: set up python ${{ matrix.python-version }}
uses: actions/setup-python@v3
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/system-tests-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ jobs:
- name: checkout ibis
uses: actions/checkout@v3
with:
# fetch depth 0 is necessary to ensure that the development version is
# computed from a tag and not computed as one commit past 0.0.0
repository: ibis-project/ibis
path: ibis
fetch-depth: 0

- name: install dependencies (ibis ${{ matrix.ibis_version }})
env:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
with:
repository: ibis-project/ibis
path: ibis
fetch-depth: 0

- name: install dependencies (ibis ${{ matrix.ibis_version }})
env:
Expand Down
7 changes: 5 additions & 2 deletions tests/unit/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
IBIS_VERSION = packaging.version.Version(ibis.__version__)
IBIS_1_4_VERSION = packaging.version.Version("1.4.0")
IBIS_3_0_VERSION = packaging.version.Version("3.0.0")
IBIS_3_0_2_VERSION = packaging.version.Version("3.0.2")


@pytest.mark.parametrize(
Expand Down Expand Up @@ -45,7 +46,8 @@
def test_literal_date(case, expected, dtype):
expr = ibis.literal(case, type=dtype).year()
result = ibis_bigquery.compile(expr)
assert result == f"SELECT EXTRACT(year from {expected}) AS `tmp`"
expected_name = "tmp" if IBIS_VERSION <= IBIS_3_0_2_VERSION else "year"
assert result == f"SELECT EXTRACT(year from {expected}) AS `{expected_name}`"


@pytest.mark.parametrize(
Expand Down Expand Up @@ -214,7 +216,8 @@ def test_hashbytes(case, expected, how, dtype):
def test_literal_timestamp_or_time(case, expected, dtype):
expr = ibis.literal(case, type=dtype).hour()
result = ibis_bigquery.compile(expr)
assert result == f"SELECT EXTRACT(hour from {expected}) AS `tmp`"
expected_name = "tmp" if IBIS_VERSION <= IBIS_3_0_2_VERSION else "hour"
assert result == f"SELECT EXTRACT(hour from {expected}) AS `{expected_name}`"


def test_projection_fusion_only_peeks_at_immediate_parent():
Expand Down

0 comments on commit dea960d

Please sign in to comment.