Skip to content

Commit 3fc4e01

Browse files
committed
Workflow fixes
1 parent 8f70b5b commit 3fc4e01

File tree

6 files changed

+81
-16
lines changed

6 files changed

+81
-16
lines changed

.github/workflows/code-quality-checks.yml

+52-1
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,63 @@ jobs:
5252
# install your root project, if required
5353
#----------------------------------------------
5454
- name: Install library
55-
run: poetry install --no-interaction --all-extras
55+
run: poetry install --no-interaction
5656
#----------------------------------------------
5757
# run test suite
5858
#----------------------------------------------
5959
- name: Run tests
6060
run: poetry run python -m pytest tests/unit
61+
run-unit-tests-with-arrow:
62+
runs-on: ubuntu-latest
63+
strategy:
64+
matrix:
65+
python-version: [ 3.8, 3.9, "3.10", "3.11" ]
66+
steps:
67+
#----------------------------------------------
68+
# check-out repo and set-up python
69+
#----------------------------------------------
70+
- name: Check out repository
71+
uses: actions/checkout@v2
72+
- name: Set up python ${{ matrix.python-version }}
73+
id: setup-python
74+
uses: actions/setup-python@v2
75+
with:
76+
python-version: ${{ matrix.python-version }}
77+
#----------------------------------------------
78+
# ----- install & configure poetry -----
79+
#----------------------------------------------
80+
- name: Install Poetry
81+
uses: snok/install-poetry@v1
82+
with:
83+
virtualenvs-create: true
84+
virtualenvs-in-project: true
85+
installer-parallel: true
86+
87+
#----------------------------------------------
88+
# load cached venv if cache exists
89+
#----------------------------------------------
90+
- name: Load cached venv
91+
id: cached-poetry-dependencies
92+
uses: actions/cache@v2
93+
with:
94+
path: .venv-pyarrow
95+
key: venv-pyarrow-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}
96+
#----------------------------------------------
97+
# install dependencies if cache does not exist
98+
#----------------------------------------------
99+
- name: Install dependencies
100+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
101+
run: poetry install --no-interaction --no-root
102+
#----------------------------------------------
103+
# install your root project, if required
104+
#----------------------------------------------
105+
- name: Install library
106+
run: poetry install --no-interaction --all-extras
107+
#----------------------------------------------
108+
# run test suite
109+
#----------------------------------------------
110+
- name: Run tests
111+
run: poetry run python -m pytest tests/unit
61112
check-linting:
62113
runs-on: ubuntu-latest
63114
strategy:

tests/unit/test_arrow_queue.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import unittest
2-
3-
import pyarrow as pa
4-
2+
import pytest
3+
try:
4+
import pyarrow as pa
5+
except ImportError:
6+
pa = None
57
from databricks.sql.utils import ArrowQueue
68

7-
9+
@pytest.mark.skipif(pa is None, reason="PyArrow is not installed")
810
class ArrowQueueSuite(unittest.TestCase):
911
@staticmethod
1012
def make_arrow_table(batch):

tests/unit/test_cloud_fetch_queue.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
import pyarrow
1+
try:
2+
import pyarrow
3+
except ImportError:
4+
pyarrow = None
25
import unittest
6+
import pytest
37
from unittest.mock import MagicMock, patch
48

59
from databricks.sql.thrift_api.TCLIService.ttypes import TSparkArrowResultLink
610
import databricks.sql.utils as utils
711
from databricks.sql.types import SSLOptions
812

9-
13+
@pytest.mark.skipif(pyarrow is None, reason="PyArrow is not installed")
1014
class CloudFetchQueueSuite(unittest.TestCase):
1115
def create_result_link(
1216
self,

tests/unit/test_fetches.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import unittest
2+
import pytest
23
from unittest.mock import Mock
34

4-
import pyarrow as pa
5+
try:
6+
import pyarrow as pa
7+
except ImportError:
8+
pa=None
59

610
import databricks.sql.client as client
711
from databricks.sql.utils import ExecuteResponse, ArrowQueue
812

9-
13+
@pytest.mark.skipif(pa is None, reason="PyArrow is not installed")
1014
class FetchTests(unittest.TestCase):
1115
"""
1216
Unit tests for checking the fetch logic.

tests/unit/test_fetches_bench.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import unittest
22
from unittest.mock import Mock
3-
4-
import pyarrow as pa
3+
try:
4+
import pyarrow as pa
5+
except ImportError:
6+
pa=None
57
import uuid
68
import time
79
import pytest
810

911
import databricks.sql.client as client
1012
from databricks.sql.utils import ExecuteResponse, ArrowQueue
1113

12-
14+
@pytest.mark.skipif(pa is None, reason="PyArrow is not installed")
1315
class FetchBenchmarkTests(unittest.TestCase):
1416
"""
1517
Micro benchmark test for Arrow result handling.

tests/unit/test_thrift_backend.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
from decimal import Decimal
33
import itertools
44
import unittest
5+
import pytest
56
from unittest.mock import patch, MagicMock, Mock
67
from ssl import CERT_NONE, CERT_REQUIRED
78
from urllib3 import HTTPSConnectionPool
8-
9-
import pyarrow
10-
9+
try:
10+
import pyarrow
11+
except ImportError:
12+
pyarrow=None
1113
import databricks.sql
1214
from databricks.sql import utils
1315
from databricks.sql.types import SSLOptions
@@ -26,7 +28,7 @@ def retry_policy_factory():
2628
"_retry_delay_default": (float, 5, 1, 60),
2729
}
2830

29-
31+
@pytest.mark.skipif(pyarrow is None,reason="PyArrow is not installed")
3032
class ThriftBackendTestSuite(unittest.TestCase):
3133
okay_status = ttypes.TStatus(statusCode=ttypes.TStatusCode.SUCCESS_STATUS)
3234

0 commit comments

Comments
 (0)