Skip to content

Commit

Permalink
remove a few mypy excludes (#1954)
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Apr 27, 2023
1 parent 2c0ea0a commit 913afe1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ follow_imports = silent
# NOTE: If you are seeing this, feel free to create a PR to cover the below files.
exclude = (?x)
^(
|tests/supervisors/test_reload.py
|tests/protocols/test_http.py
|tests/protocols/test_utils.py
)$

Expand Down
2 changes: 1 addition & 1 deletion tests/protocols/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
try:
from uvicorn.protocols.http.httptools_impl import HttpToolsProtocol
except ImportError: # pragma: nocover
HttpToolsProtocol = None
HttpToolsProtocol = None # type: ignore[misc,assignment]


HTTP_PROTOCOLS = [p for p in [H11Protocol, HttpToolsProtocol] if p is not None]
Expand Down
11 changes: 7 additions & 4 deletions tests/supervisors/test_reload.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys
from pathlib import Path
from time import sleep
from typing import Optional, Type
from typing import List, Optional, Type

import pytest

Expand All @@ -16,12 +16,12 @@
try:
from uvicorn.supervisors.watchfilesreload import WatchFilesReload
except ImportError: # pragma: no cover
WatchFilesReload = None
WatchFilesReload = None # type: ignore[misc,assignment]

try:
from uvicorn.supervisors.watchgodreload import WatchGodReload
except ImportError: # pragma: no cover
WatchGodReload = None
WatchGodReload = None # type: ignore[misc,assignment]


def run(sockets):
Expand Down Expand Up @@ -53,7 +53,9 @@ def _setup_reloader(self, config: Config) -> BaseReload:
reloader.startup()
return reloader

def _reload_tester(self, touch_soon, reloader: BaseReload, *files: Path) -> bool:
def _reload_tester(
self, touch_soon, reloader: BaseReload, *files: Path
) -> Optional[List[Path]]:
reloader.restart()
if WatchFilesReload is not None and isinstance(reloader, WatchFilesReload):
touch_soon(*files)
Expand Down Expand Up @@ -267,6 +269,7 @@ def test_watchfiles_no_changes(self) -> None:

from watchfiles import watch

assert isinstance(reloader, WatchFilesReload)
# just so we can make rust_timeout 100ms
reloader.watcher = watch(
sub_dir,
Expand Down

0 comments on commit 913afe1

Please sign in to comment.