Skip to content

Commit 01e0c04

Browse files
authored
Merge pull request #12 from dotX12/dev-1.0
added tests, change typehints 3.10 to old syntax
2 parents b743689 + de4aef3 commit 01e0c04

File tree

10 files changed

+524
-38
lines changed

10 files changed

+524
-38
lines changed

.github/workflows/pytest.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: test
2+
3+
on: pull_request
4+
5+
jobs:
6+
test:
7+
strategy:
8+
fail-fast: true
9+
matrix:
10+
os: [ "ubuntu-latest", "macos-latest" ]
11+
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
12+
name: Python ${{ matrix.python-version }} OS ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
steps:
15+
#----------------------------------------------
16+
# check-out repo and set-up python
17+
#----------------------------------------------
18+
- name: Check out repository
19+
uses: actions/checkout@v2
20+
- name: Set up python ${{ matrix.python-version }}
21+
id: setup-python
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
#----------------------------------------------
27+
# ----- install & configure poetry -----
28+
#----------------------------------------------
29+
- name: Install Poetry
30+
uses: snok/install-poetry@v1
31+
with:
32+
version: 1.2.0
33+
virtualenvs-path: .venv
34+
virtualenvs-create: true
35+
virtualenvs-in-project: false
36+
installer-parallel: true
37+
38+
#----------------------------------------------
39+
# load cached venv if cache exists
40+
#----------------------------------------------
41+
- name: Load cached venv
42+
id: cached-poetry-dependencies
43+
uses: actions/cache@v2
44+
with:
45+
path: .venv
46+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
47+
#----------------------------------------------
48+
# install dependencies if cache does not exist
49+
#----------------------------------------------
50+
51+
- name: Install dependencies
52+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
53+
run: poetry install --no-interaction --no-root
54+
#----------------------------------------------
55+
# install your root project, if required
56+
#----------------------------------------------
57+
- name: Install library
58+
run: poetry install --no-interaction --with tests
59+
#----------------------------------------------
60+
# run test suite
61+
#----------------------------------------------
62+
- name: Check black
63+
run: |
64+
poetry add --dev black --allow-prereleases
65+
poetry run black . --check
66+
67+
- name: Run tests
68+
run: |
69+
poetry run pytest

examples/main.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
from fastapi import File
33
from fastapi import UploadFile
44

5-
from examples.models import PostContractBodySchema, ExampleSchemaForHeader, PostContractBodySchemaOldSupport
5+
from examples.models import (
6+
PostContractBodySchema,
7+
ExampleSchemaForHeader,
8+
PostContractBodySchemaOldSupport,
9+
)
610
from examples.models import PostContractJSONSchema
711
from examples.models import PostContractSmallDoubleBodySchema
812
from examples.models import PostContractSmallDoubleQuerySchema
@@ -74,4 +78,3 @@ async def example_foo_body_handler(
7478
document: UploadFile = File(...),
7579
):
7680
return {"title": data.title, "date": data.date, "file_name": document.filename}
77-

0 commit comments

Comments
 (0)