Skip to content
This repository was archived by the owner on Nov 19, 2023. It is now read-only.

Commit a359549

Browse files
authored
Merge pull request #240 from snok/sondrelg/ci
Update linting workflow
2 parents 8aac7b8 + 2e7d964 commit a359549

File tree

6 files changed

+328
-364
lines changed

6 files changed

+328
-364
lines changed

.github/workflows/codecov.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

.github/workflows/testing.yml

Lines changed: 59 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,38 @@
11
name: test
22

3-
on: pull_request
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
48

59
jobs:
610
linting:
711
runs-on: ubuntu-latest
812
steps:
9-
- uses: snok/.github/workflows/linting@main
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-python@v2
15+
with:
16+
python-version: "3.10"
17+
- uses: actions/cache@v2
18+
id: cache-venv
19+
with:
20+
path: .venv
21+
key: venv-0 # increment to reset
22+
- run: |
23+
pip install virtualenv
24+
virtualenv .venv
25+
source .venv/bin/activate
26+
pip install pre-commit
27+
if: steps.cache-venv.outputs.cache-hit != 'true'
28+
- uses: actions/cache@v2
29+
id: pre-commit-cache
30+
with:
31+
path: ~/.cache/pre-commit
32+
key: key-0
33+
- run: |
34+
source .venv/bin/activate
35+
pre-commit run --all-files
1036
1137
get-python-versions:
1238
runs-on: ubuntu-latest
@@ -17,48 +43,59 @@ jobs:
1743
id: get-python-versions-action
1844
with:
1945
min-version: 3.6
20-
include-prereleases: true
46+
include-prereleases: false
2147

2248
test:
23-
needs: [linting, get-python-versions]
49+
needs: [get-python-versions]
2450
runs-on: ubuntu-latest
2551
strategy:
2652
fail-fast: false
2753
matrix:
2854
python-version: ${{ fromJson(needs.get-python-versions.outputs.python-matrix) }}
2955
django-version: [ "2.2", "3.0", "3.1", "3.2" ]
3056
steps:
31-
- name: Check out repository
32-
uses: actions/checkout@v2
33-
- name: Set up python ${{ matrix.python-version }}
34-
uses: actions/setup-python@v2
57+
- uses: actions/checkout@v2
58+
- uses: actions/setup-python@v2
59+
with:
60+
python-version: "${{ matrix.python-version }}"
61+
- uses: actions/cache@v2
62+
id: poetry-cache
3563
with:
36-
python-version: ${{ matrix.python-version }}
64+
path: ~/.local
65+
key: key-0
3766
- name: Install poetry
3867
uses: snok/install-poetry@v1
3968
with:
4069
version: 1.2.0a2
41-
virtualenvs-in-project: true
42-
- name: Load cached venv
43-
uses: actions/cache@v2
70+
virtualenvs-create: false
71+
- uses: actions/cache@v2
4472
id: cache-venv
4573
with:
4674
path: .venv
47-
key: ${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-4
48-
- name: Install dependencies
49-
run: poetry install --no-interaction --no-root
75+
key: ${{ hashFiles('**/poetry.lock') }}-0
76+
- run: |
77+
pip install virtualenv
78+
virtualenv .venv
79+
source .venv/bin/activate
80+
pip install pip setuptools wheel -U
81+
poetry install --no-interaction --no-root
5082
if: steps.cache-venv.outputs.cache-hit != 'true'
51-
- name: Install package
52-
run: poetry install --no-interaction
53-
- name: Install django ${{ matrix.django-version }}
54-
run: |
83+
- run: |
5584
source .venv/bin/activate
56-
poetry add "Django==${{ matrix.django-version }}"
85+
pip install "Django==${{ matrix.django-version }}"
5786
- name: Install DRF 3.11 on Django 2.2
5887
if: matrix.django-version == '2.2'
59-
run: poetry add "djangorestframework==3.11.1"
88+
run: pip install "djangorestframework==3.11.1"
89+
- run: pip install coverage
90+
if: matrix.python-version == '3.10'
6091
- name: Run tests
6192
run: |
6293
source .venv/bin/activate
63-
poetry run pytest --cov=openapi_tester --verbose --assert=plain
94+
poetry run pytest --cov=openapi_tester --verbose --assert=plain --cov-report=xml
6495
poetry run coverage report
96+
- uses: codecov/codecov-action@v2
97+
with:
98+
file: ./coverage.xml
99+
fail_ci_if_error: true
100+
token: ${{ secrets.CODECOV_TOKEN }}
101+
if: matrix.python-version == '3.10'

openapi_tester/schema_tester.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def get_response_schema_section(self, response: td.Response) -> Dict[str, Any]:
137137
f"\n\nUndocumented status code: {response.status_code}.\n\nDocumented status codes: {list(responses_object.keys())}. ",
138138
)
139139

140-
if "openapi" not in schema:
140+
if "openapi" not in schema: # pylint: disable=E1135
141141
# openapi 2.0, i.e. "swagger" has a different structure than openapi 3.0 status sub-schemas
142142
return self.get_key_value(status_code_object, "schema")
143143
content_object = self.get_key_value(

0 commit comments

Comments
 (0)