Skip to content

Commit 9217f50

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 2b29776 commit 9217f50

File tree

6 files changed

+21
-3
lines changed

6 files changed

+21
-3
lines changed

.github/workflows/lint.yml

Lines changed: 8 additions & 0 deletions
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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[mypy]
2+
files = gitlab/*.py

gitlab/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def main():
186186
# Now we build the entire set of subcommands and do the complete parsing
187187
parser = _get_parser(cli_module)
188188
try:
189-
import argcomplete
189+
import argcomplete # type: ignore
190190

191191
argcomplete.autocomplete(parser)
192192
except Exception:

gitlab/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from gitlab.const import * # noqa
2727
from gitlab.exceptions import * # noqa
2828
from gitlab import utils # noqa
29-
from requests_toolbelt.multipart.encoder import MultipartEncoder
29+
from requests_toolbelt.multipart.encoder import MultipartEncoder # type: ignore
3030

3131

3232
REDIRECT_MSG = (

test-requirements.txt

Lines changed: 1 addition & 0 deletions
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

Lines changed: 8 additions & 1 deletion
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)