Skip to content

Commit

Permalink
chore: add basic type checks to functional/api tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nejch authored and JohnVillalovos committed Oct 27, 2022
1 parent ee143c9 commit 5b642a5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions pyproject.toml
Expand Up @@ -8,18 +8,19 @@ files = "."
exclude = "build/.*"
strict = true

[[tool.mypy.overrides]] # Overrides for currently untyped modules
# Overrides for currently untyped modules
[[tool.mypy.overrides]]
module = [
"docs.*",
"docs.ext.*",
"tests.functional.api.*",
"tests.unit.*",
]
ignore_errors = true

[[tool.mypy.overrides]]
module = [
"tests.functional.*",
"tests.functional.api.*",
"tests.meta.*",
"tests.smoke.*",
]
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/api/test_import_export.py
Expand Up @@ -45,7 +45,7 @@ def test_project_import_export(gl, project, temp_dir):
raise Exception("Project export taking too much time")

with open(temp_dir / "gitlab-export.tgz", "wb") as f:
export.download(streamed=True, action=f.write)
export.download(streamed=True, action=f.write) # type: ignore[arg-type]

output = gl.projects.import_project(
open(temp_dir / "gitlab-export.tgz", "rb"),
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/api/test_keys.py
Expand Up @@ -6,7 +6,7 @@
import hashlib


def key_fingerprint(key):
def key_fingerprint(key: str) -> str:
key_part = key.split()[1]
decoded = base64.b64decode(key_part.encode("ascii"))
digest = hashlib.sha256(decoded).digest()
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/api/test_merge_requests.py
Expand Up @@ -177,7 +177,7 @@ def test_merge_request_reset_approvals(gitlab_url, project, wait_for_sidekiq):
bot_project = bot_gitlab.projects.get(project.id, lazy=True)

wait_for_sidekiq(timeout=60)
mr = bot_project.mergerequests.list()[0]
mr = bot_project.mergerequests.list()[0] # type: ignore[index]
assert mr.reset_approvals()


Expand Down
2 changes: 1 addition & 1 deletion tests/functional/api/test_projects.py
Expand Up @@ -142,7 +142,7 @@ def test_project_forks(gl, project, user):
assert fork_project.forked_from_project["id"] == project.id

forks = project.forks.list()
assert fork.id in map(lambda fork_project: fork_project.id, forks)
assert fork.id in [fork_project.id for fork_project in forks]


def test_project_hooks(project):
Expand Down

0 comments on commit 5b642a5

Please sign in to comment.