Skip to content

Commit a34963e

Browse files
committed
github action python test static checks
1 parent 0c2feaf commit a34963e

File tree

6 files changed

+125
-61
lines changed

6 files changed

+125
-61
lines changed

.github/workflows/python-test.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,44 @@ jobs:
6060

6161
- name: Upload coverage
6262
uses: codecov/codecov-action@v1
63+
64+
static-checks:
65+
name: "Static checks"
66+
runs-on: ubuntu-latest
67+
steps:
68+
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
69+
uses: actions/checkout@v2
70+
71+
- name: "Setup Python"
72+
uses: actions/setup-python@v2
73+
with:
74+
python-version: 3.9
75+
76+
- name: Get full Python version
77+
id: full-python-version
78+
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
79+
80+
- name: Bootstrap poetry
81+
run: |
82+
curl -sL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python - -y
83+
echo "$HOME/.local/bin" >> $GITHUB_PATH
84+
85+
- name: Configure poetry
86+
run: poetry config virtualenvs.in-project true
87+
88+
- name: Set up cache
89+
uses: actions/cache@v2
90+
id: cache
91+
with:
92+
path: .venv
93+
key: venv-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
94+
95+
- name: Ensure cache is healthy
96+
if: steps.cache.outputs.cache-hit == 'true'
97+
run: timeout 10s poetry run pip --version || rm -rf .venv
98+
99+
- name: Install dependencies
100+
run: poetry install
101+
102+
- name: Run static checks
103+
run: poetry run pre-commit run -a

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
- id: check-hooks-apply
1111

1212
- repo: https://github.com/asottile/pyupgrade
13-
rev: v2.19.0
13+
rev: v2.38.4
1414
hooks:
1515
- id: pyupgrade
1616
args: ["--py36-plus"]

openapi_schema_validator/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from openapi_schema_validator._format import oas31_format_checker
33
from openapi_schema_validator.shortcuts import validate
44
from openapi_schema_validator.validators import OAS30ReadValidator
5-
from openapi_schema_validator.validators import OAS30WriteValidator
65
from openapi_schema_validator.validators import OAS30Validator
6+
from openapi_schema_validator.validators import OAS30WriteValidator
77
from openapi_schema_validator.validators import OAS31Validator
88

99
__author__ = "Artur Maciag"

openapi_schema_validator/_validators.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,7 @@ def read_required(
187187
prop_schema = schema.get("properties", {}).get(property)
188188
if prop_schema:
189189
write_only = prop_schema.get("writeOnly", False)
190-
if (
191-
getattr(validator, "read", True)
192-
and write_only
193-
):
190+
if getattr(validator, "read", True) and write_only:
194191
continue
195192
yield ValidationError(f"{property!r} is a required property")
196193

openapi_schema_validator/validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import warnings
12
from typing import Any
23
from typing import Type
3-
import warnings
44

55
from jsonschema import _legacy_validators
66
from jsonschema import _utils

0 commit comments

Comments
 (0)