Skip to content

Commit fdec039

Browse files
feat: add an initial mypy test to tox.ini
Add an initial mypy test to test gitlab/base.py and gitlab/__init__.py
1 parent d9fdf1d commit fdec039

File tree

6 files changed

+21
-3
lines changed

6 files changed

+21
-3
lines changed

.github/workflows/lint.yml

+8
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,11 @@ jobs:
2727
with:
2828
fetch-depth: 0
2929
- uses: wagoid/commitlint-github-action@v2
30+
31+
mypy:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v2
35+
- uses: actions/setup-python@v2
36+
- run: pip install --upgrade tox
37+
- run: tox -e mypy

.mypy.ini

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[mypy]
2+
files = gitlab/*.py

gitlab/cli.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def main():
193193
# Now we build the entire set of subcommands and do the complete parsing
194194
parser = _get_parser(gitlab.v4.cli)
195195
try:
196-
import argcomplete
196+
import argcomplete # type: ignore
197197

198198
argcomplete.autocomplete(parser)
199199
except Exception:

gitlab/client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import gitlab.const
2626
import gitlab.exceptions
2727
from gitlab import utils
28-
from requests_toolbelt.multipart.encoder import MultipartEncoder
28+
from requests_toolbelt.multipart.encoder import MultipartEncoder # type: ignore
2929

3030

3131
REDIRECT_MSG = (

test-requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
coverage
22
httmock
33
mock
4+
mypy
45
pytest
56
pytest-cov
67
responses

tox.ini

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tox]
22
minversion = 1.6
33
skipsdist = True
4-
envlist = py39,py38,py37,py36,pep8,black,twine-check
4+
envlist = py39,py38,py37,py36,pep8,black,twine-check,mypy
55

66
[testenv]
77
passenv = GITLAB_IMAGE GITLAB_TAG
@@ -35,6 +35,13 @@ deps = -r{toxinidir}/requirements.txt
3535
commands =
3636
twine check dist/*
3737

38+
[testenv:mypy]
39+
basepython = python3
40+
deps = -r{toxinidir}/requirements.txt
41+
-r{toxinidir}/test-requirements.txt
42+
commands =
43+
mypy {posargs}
44+
3845
[testenv:venv]
3946
commands = {posargs}
4047

0 commit comments

Comments
 (0)