Skip to content

Commit 2ee7052

Browse files
authored
Fixes most default tests (Netflix#1472)
Adds schemathesis for testing API functions.
1 parent 55b6bd2 commit 2ee7052

81 files changed

Lines changed: 1403 additions & 657 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/python.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,8 @@ name: Python Lint and Test
33
on: pull_request
44

55
jobs:
6-
lint:
6+
test:
77
runs-on: ubuntu-latest
8-
steps:
9-
- uses: actions/checkout@v2
10-
- uses: actions/setup-python@v2
11-
- uses: psf/black@stable
12-
13-
build:
14-
needs: lint
15-
runs-on: ubuntu-latest
16-
178
services:
189
postgres:
1910
image: postgres
@@ -25,26 +16,33 @@ jobs:
2516
- 5432:5432
2617
# needed because the postgres container does not provide a healthcheck
2718
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
28-
2919
steps:
3020
- name: Check out Git repository
3121
uses: actions/checkout@v2
32-
3322
- name: Set up Python 3.8
34-
uses: actions/setup-python@v1
23+
uses: actions/setup-python@v2
3524
with:
3625
python-version: 3.8
37-
26+
- uses: actions/cache@v2
27+
with:
28+
path: ~/.cache/pip
29+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
30+
restore-keys: |
31+
${{ runner.os }}-pip-
3832
- name: Install python dependencies
3933
run: |
4034
export DISPATCH_LIGHT_BUILD=1
4135
python -m pip install --upgrade pip
4236
pip install -e ".[dev]"
43-
44-
- name: Run Flake8
37+
- name: "Lint with black"
38+
uses: psf/black@stable
39+
- name: "Lint with flake8"
4540
run: |
46-
flake8 .
47-
41+
# stop the build if there are Python syntax errors or undefined names
42+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
43+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
44+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
4845
- name: Test with pytest
4946
run: |
50-
pytest
47+
pip install pytest-cov
48+
pytest --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html

requirements-base.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ arrow
55
bcrypt
66
cachetools==3.1.1 # NOTE pinning for google-auth
77
chardet==3.0.4
8-
click
8+
click==7.1.2
99
email-validator
1010
emails
1111
fastapi
1212
google-api-python-client
1313
google-auth-oauthlib
1414
h11==0.9.0 # NOTE pinning due to uvicorn
1515
httpx
16-
idna==2.10
16+
schemathesis
1717
jinja2
1818
jira
1919
joblib

requirements-base.txt

Lines changed: 65 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ asgiref==3.3.4
1717
async-timeout==3.0.1
1818
# via aiohttp
1919
attrs==20.3.0
20-
# via aiohttp
20+
# via
21+
# aiohttp
22+
# hypothesis
23+
# hypothesis-graphql
24+
# jsonschema
25+
# pytest
26+
# schemathesis
2127
bcrypt==3.2.0
2228
# via -r requirements-base.in
2329
blis==0.7.4
@@ -49,10 +55,13 @@ chardet==3.0.4
4955
# emails
5056
charset-normalizer==2.0.1
5157
# via requests
52-
click==8.0.1
58+
click==7.1.2
5359
# via
5460
# -r requirements-base.in
61+
# schemathesis
5562
# uvicorn
63+
colorama==0.4.4
64+
# via schemathesis
5665
cryptography==3.4.6
5766
# via oauthlib
5867
cssselect==1.1.0
@@ -61,6 +70,8 @@ cssutils==2.2.0
6170
# via
6271
# emails
6372
# premailer
73+
curlify==2.2.1
74+
# via schemathesis
6475
cymem==2.0.5
6576
# via
6677
# preshed
@@ -96,6 +107,8 @@ google-auth-oauthlib==0.4.4
96107
# via -r requirements-base.in
97108
googleapis-common-protos==1.53.0
98109
# via google-api-core
110+
graphql-core==3.1.5
111+
# via hypothesis-graphql
99112
h11==0.9.0
100113
# via
101114
# -r requirements-base.in
@@ -110,19 +123,35 @@ httplib2==0.19.0
110123
# oauth2client
111124
httpx==0.18.1
112125
# via -r requirements-base.in
126+
hypothesis==6.14.3
127+
# via
128+
# hypothesis-graphql
129+
# hypothesis-jsonschema
130+
# schemathesis
131+
hypothesis-graphql==0.5.0
132+
# via schemathesis
133+
hypothesis-jsonschema==0.20.1
134+
# via schemathesis
113135
idna==2.10
114136
# via
115-
# -r requirements-base.in
116137
# email-validator
117138
# requests
118139
# rfc3986
119140
# yarl
141+
iniconfig==1.1.1
142+
# via pytest
120143
jinja2==3.0.1
121144
# via -r requirements-base.in
122145
jira==2.0.0
123146
# via -r requirements-base.in
124147
joblib==1.0.1
125148
# via -r requirements-base.in
149+
jsonschema==3.2.0
150+
# via
151+
# hypothesis-jsonschema
152+
# schemathesis
153+
junit-xml==1.9
154+
# via schemathesis
126155
lxml==4.6.3
127156
# via
128157
# emails
@@ -174,6 +203,8 @@ plac==1.1.3
174203
# via
175204
# spacy
176205
# thinc
206+
pluggy==0.13.1
207+
# via pytest
177208
premailer==3.7.0
178209
# via emails
179210
preshed==3.0.5
@@ -186,6 +217,8 @@ protobuf==3.15.6
186217
# googleapis-common-protos
187218
psycopg2-binary==2.9.1
188219
# via -r requirements-base.in
220+
py==1.10.0
221+
# via pytest
189222
pyasn1==0.4.8
190223
# via
191224
# oauth2client
@@ -207,6 +240,14 @@ pyparsing==2.4.7
207240
# -r requirements-base.in
208241
# httplib2
209242
# packaging
243+
pyrsistent==0.18.0
244+
# via jsonschema
245+
pytest==6.2.4
246+
# via
247+
# pytest-subtests
248+
# schemathesis
249+
pytest-subtests==0.5.0
250+
# via schemathesis
210251
python-dateutil==2.8.2
211252
# via
212253
# -r requirements-base.in
@@ -227,16 +268,20 @@ pytz==2021.1
227268
# -r requirements-base.in
228269
# google-api-core
229270
# pandas
271+
pyyaml==5.4.1
272+
# via schemathesis
230273
requests==2.26.0
231274
# via
232275
# -r requirements-base.in
276+
# curlify
233277
# emails
234278
# google-api-core
235279
# jira
236280
# pdpyras
237281
# premailer
238282
# requests-oauthlib
239283
# requests-toolbelt
284+
# schemathesis
240285
# spacy
241286
requests-oauthlib==1.3.0
242287
# via
@@ -253,6 +298,8 @@ rsa==4.7.2
253298
# python-jose
254299
schedule==1.1.0
255300
# via -r requirements-base.in
301+
schemathesis==3.9.6
302+
# via -r requirements-base.in
256303
scipy==1.6.1
257304
# via statsmodels
258305
sentry-asgi==0.2.0
@@ -271,6 +318,8 @@ six==1.15.0
271318
# google-auth
272319
# google-auth-httplib2
273320
# jira
321+
# jsonschema
322+
# junit-xml
274323
# oauth2client
275324
# patsy
276325
# protobuf
@@ -285,6 +334,8 @@ sniffio==1.2.0
285334
# via
286335
# httpcore
287336
# httpx
337+
sortedcontainers==2.4.0
338+
# via hypothesis
288339
spacy==2.3.5
289340
# via -r requirements-base.in
290341
sqlalchemy==1.3.24
@@ -302,7 +353,9 @@ srsly==1.0.5
302353
# spacy
303354
# thinc
304355
starlette==0.14.2
305-
# via fastapi
356+
# via
357+
# fastapi
358+
# schemathesis
306359
statsmodels==0.12.2
307360
# via -r requirements-base.in
308361
tabulate==0.8.9
@@ -313,6 +366,8 @@ text-unidecode==1.3
313366
# via python-slugify
314367
thinc==7.4.5
315368
# via spacy
369+
toml==0.10.2
370+
# via pytest
316371
tqdm==4.59.0
317372
# via
318373
# spacy
@@ -321,6 +376,7 @@ typing-extensions==3.7.4.3
321376
# via
322377
# aiohttp
323378
# pydantic
379+
# schemathesis
324380
uritemplate==3.0.1
325381
# via google-api-python-client
326382
urllib3==1.26.5
@@ -336,8 +392,12 @@ wasabi==0.8.2
336392
# via
337393
# spacy
338394
# thinc
395+
werkzeug==2.0.1
396+
# via schemathesis
339397
yarl==1.6.3
340-
# via aiohttp
398+
# via
399+
# aiohttp
400+
# schemathesis
341401

342402
# The following packages are considered to be unsafe in a requirements file:
343403
# setuptools

requirements-dev.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# This file is autogenerated by pip-compile
2+
# This file is autogenerated by pip-compile with python 3.8
33
# To update, run:
44
#
55
# pip-compile --no-emit-index-url requirements-dev.in
@@ -10,7 +10,7 @@ attrs==20.3.0
1010
# via pytest
1111
black==21.7b0
1212
# via -r requirements-dev.in
13-
click==8.0.1
13+
click==7.1.2
1414
# via black
1515
coverage==5.5
1616
# via -r requirements-dev.in

0 commit comments

Comments
 (0)