Skip to content

Commit b3569b9

Browse files
committed
formatting
1 parent 0767cec commit b3569b9

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/pytest_api_cov/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def generate_pyproject_config(framework: str) -> str:
8989
"""
9090

9191

92-
def cmd_init():
92+
def cmd_init() -> int:
9393
"""Initialize pytest-api-cov setup in current directory."""
9494
print("🚀 pytest-api-cov Setup Wizard")
9595
print("=" * 40)
@@ -171,7 +171,7 @@ def read_root():
171171
return 0
172172

173173

174-
def main():
174+
def main() -> int:
175175
"""Main CLI entry point."""
176176
parser = argparse.ArgumentParser(prog="pytest-api-cov", description="pytest API coverage plugin CLI tools")
177177

src/pytest_api_cov/frameworks.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def get_tracked_client(self, recorder: Optional["ApiCallRecorder"], test_name: s
3131
return self.app.test_client()
3232

3333
class TrackingFlaskClient(FlaskClient):
34-
def open(self, *args, **kwargs) -> Any:
34+
def open(self, *args: Any, **kwargs: Any) -> Any:
3535
path = kwargs.get("path") or (args[0] if args else None)
3636
if path and hasattr(self.application.url_map, "bind"):
3737
try:
@@ -58,9 +58,10 @@ def get_tracked_client(self, recorder: Optional["ApiCallRecorder"], test_name: s
5858
return TestClient(self.app)
5959

6060
class TrackingFastAPIClient(TestClient):
61-
def send(self, *args, **kwargs) -> Any:
61+
def send(self, *args: Any, **kwargs: Any) -> Any:
6262
request = args[0]
63-
recorder.record_call(request.url.path, test_name)
63+
if recorder is not None:
64+
recorder.record_call(request.url.path, test_name)
6465
return super().send(*args, **kwargs)
6566

6667
return TrackingFastAPIClient(self.app)

src/pytest_api_cov/models.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Data models for pytest-api-cov."""
22

3-
from typing import Any, Dict, Iterator, List, Set, Tuple
3+
from typing import Any, Dict, Iterable, List, Set, Tuple
44

55
from pydantic import BaseModel, Field
66

@@ -51,15 +51,15 @@ def __contains__(self, endpoint: str) -> bool:
5151
"""Check if an endpoint has been recorded."""
5252
return endpoint in self.calls
5353

54-
def items(self) -> Iterator[Tuple[str, Set[str]]]:
54+
def items(self) -> Iterable[Tuple[str, Set[str]]]:
5555
"""Iterate over endpoint, callers pairs."""
5656
return self.calls.items()
5757

58-
def keys(self) -> Iterator[str]:
58+
def keys(self) -> Iterable[str]:
5959
"""Get all recorded endpoints."""
6060
return self.calls.keys()
6161

62-
def values(self) -> Iterator[Set[str]]:
62+
def values(self) -> Iterable[Set[str]]:
6363
"""Get all caller sets."""
6464
return self.calls.values()
6565

@@ -84,7 +84,7 @@ def __len__(self) -> int:
8484
"""Return number of discovered endpoints."""
8585
return len(self.endpoints)
8686

87-
def __iter__(self) -> Iterator[str]: # type: ignore[override]
87+
def __iter__(self) -> Iterable[str]: # type: ignore[override]
8888
"""Iterate over discovered endpoints."""
8989
return iter(self.endpoints)
9090

0 commit comments

Comments
 (0)