Skip to content

Commit 1b866f0

Browse files
author
Jesse
authored
Set up github actions + remove databricks-specific test infra (#3)
* Remove databricks-specific test fixtures * Introduce pytest, black, and mypy workflows * Skip test_fetches_bench case * Remove references to databricks-specific testing infra
1 parent e8b4d01 commit 1b866f0

11 files changed

+152
-75
lines changed
+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: Code Quality Checks
2+
on: [push]
3+
jobs:
4+
run-tests:
5+
runs-on: ubuntu-latest
6+
steps:
7+
#----------------------------------------------
8+
# check-out repo and set-up python
9+
#----------------------------------------------
10+
- name: Check out repository
11+
uses: actions/checkout@v2
12+
- name: Set up python
13+
id: setup-python
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: 3.7
17+
#----------------------------------------------
18+
# ----- install & configure poetry -----
19+
#----------------------------------------------
20+
- name: Install Poetry
21+
uses: snok/install-poetry@v1
22+
with:
23+
virtualenvs-create: true
24+
virtualenvs-in-project: true
25+
installer-parallel: true
26+
27+
#----------------------------------------------
28+
# load cached venv if cache exists
29+
#----------------------------------------------
30+
- name: Load cached venv
31+
id: cached-poetry-dependencies
32+
uses: actions/cache@v2
33+
with:
34+
path: .venv
35+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}
36+
#----------------------------------------------
37+
# install dependencies if cache does not exist
38+
#----------------------------------------------
39+
- name: Install dependencies
40+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
41+
run: poetry install --no-interaction --no-root
42+
#----------------------------------------------
43+
# install your root project, if required
44+
#----------------------------------------------
45+
- name: Install library
46+
run: poetry install --no-interaction
47+
#----------------------------------------------
48+
# run test suite
49+
#----------------------------------------------
50+
- name: Run tests
51+
run: poetry run pytest tests/
52+
check-linting:
53+
runs-on: ubuntu-latest
54+
steps:
55+
#----------------------------------------------
56+
# check-out repo and set-up python
57+
#----------------------------------------------
58+
- name: Check out repository
59+
uses: actions/checkout@v2
60+
- name: Set up python
61+
id: setup-python
62+
uses: actions/setup-python@v2
63+
with:
64+
python-version: 3.7
65+
#----------------------------------------------
66+
# ----- install & configure poetry -----
67+
#----------------------------------------------
68+
- name: Install Poetry
69+
uses: snok/install-poetry@v1
70+
with:
71+
virtualenvs-create: true
72+
virtualenvs-in-project: true
73+
installer-parallel: true
74+
75+
#----------------------------------------------
76+
# load cached venv if cache exists
77+
#----------------------------------------------
78+
- name: Load cached venv
79+
id: cached-poetry-dependencies
80+
uses: actions/cache@v2
81+
with:
82+
path: .venv
83+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}
84+
#----------------------------------------------
85+
# install dependencies if cache does not exist
86+
#----------------------------------------------
87+
- name: Install dependencies
88+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
89+
run: poetry install --no-interaction --no-root
90+
#----------------------------------------------
91+
# install your root project, if required
92+
#----------------------------------------------
93+
- name: Install library
94+
run: poetry install --no-interaction
95+
#----------------------------------------------
96+
# black the code
97+
#----------------------------------------------
98+
- name: Black
99+
run: poetry run black --check src
100+
101+
check-types:
102+
runs-on: ubuntu-latest
103+
steps:
104+
#----------------------------------------------
105+
# check-out repo and set-up python
106+
#----------------------------------------------
107+
- name: Check out repository
108+
uses: actions/checkout@v2
109+
- name: Set up python
110+
id: setup-python
111+
uses: actions/setup-python@v2
112+
with:
113+
python-version: 3.7
114+
#----------------------------------------------
115+
# ----- install & configure poetry -----
116+
#----------------------------------------------
117+
- name: Install Poetry
118+
uses: snok/install-poetry@v1
119+
with:
120+
virtualenvs-create: true
121+
virtualenvs-in-project: true
122+
installer-parallel: true
123+
124+
#----------------------------------------------
125+
# load cached venv if cache exists
126+
#----------------------------------------------
127+
- name: Load cached venv
128+
id: cached-poetry-dependencies
129+
uses: actions/cache@v2
130+
with:
131+
path: .venv
132+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}
133+
#----------------------------------------------
134+
# install dependencies if cache does not exist
135+
#----------------------------------------------
136+
- name: Install dependencies
137+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
138+
run: poetry install --no-interaction --no-root
139+
#----------------------------------------------
140+
# install your root project, if required
141+
#----------------------------------------------
142+
- name: Install library
143+
run: poetry install --no-interaction
144+
#----------------------------------------------
145+
# black the code
146+
#----------------------------------------------
147+
- name: Mypy
148+
run: poetry run mypy src

python-37-slim-buster.dockerfile

-1
This file was deleted.

test-container-with-reqs.dockerfile

-3
This file was deleted.

tests/docker-run-unit.sh

-5
This file was deleted.

tests/test_fetches.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99

1010
class FetchTests(unittest.TestCase):
1111
"""
12-
Unit tests for checking the fetch logic. See
13-
qa/test/cmdexec/python/suites/simple_connection_test.py for integration tests that
14-
interact with the server.
12+
Unit tests for checking the fetch logic.
1513
"""
1614

1715
@staticmethod

tests/test_fetches_bench.py

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import pyarrow as pa
55
import uuid
66
import time
7+
import pytest
78

89
import databricks.sql.client as client
910
from databricks.sql.utils import ExecuteResponse, ArrowQueue
@@ -39,6 +40,7 @@ def make_dummy_result_set_from_initial_results(arrow_table):
3940
for col_id in range(arrow_table.num_columns)]
4041
return rs
4142

43+
@pytest.mark.skip(reason="Test has not been updated for latest connector API (June 2022)")
4244
def test_benchmark_fetchall(self):
4345
print("preparing dummy arrow table")
4446
arrow_table = FetchBenchmarkTests.make_arrow_table(10, 25000)

tests/tests.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919

2020
class ClientTestSuite(unittest.TestCase):
2121
"""
22-
Unit tests for isolated client behaviour. See
23-
qa/test/cmdexec/python/suites/simple_connection_test.py for integration tests that
24-
interact with the server.
22+
Unit tests for isolated client behaviour.
2523
"""
2624

2725
PACKAGE_NAME = "databricks.sql"

thrift_dbr_test/README.md

-6
This file was deleted.

thrift_dbr_test/__init__.py

Whitespace-only changes.

thrift_dbr_test/thrift_basic_tests.py

-20
This file was deleted.

thrift_dbr_test/thrift_sqlquery_tests.py

-34
This file was deleted.

0 commit comments

Comments
 (0)