Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/ms_azure/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import threading
from datetime import datetime, timedelta
from http.server import BaseHTTPRequestHandler, HTTPServer
from typing import Any, Dict, List, Tuple
from typing import Any, Dict, List, Optional, Tuple, Type
from unittest import mock

import pytest
Expand Down Expand Up @@ -238,16 +238,16 @@ def test_request_respects_explicit_timeout(
)


def _start_local_server(handler: type[BaseHTTPRequestHandler]) -> tuple[HTTPServer, int]:
def _start_local_server(handler: Type[BaseHTTPRequestHandler]) -> Tuple[HTTPServer, int]:
server = HTTPServer(("127.0.0.1", 0), handler)
port = server.server_address[1]
threading.Thread(target=server.serve_forever, daemon=True).start()
return server, port


def _sequential_http_handler(
responses: List[Tuple[int, bytes | None]],
Copy link
Copy Markdown
Collaborator

@lslebodn lslebodn May 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from __future__ import annotations should help to keep simplified syntax introduced in https://peps.python.org/pep-0604/.

Cause it makes all annotations strings (PEP 563 deferred evaluation) rather than
evaluating them eagerly. But I would prefer to have deferred just in 3.9

And we should test it with python3.9 anyway.

) -> tuple[type[BaseHTTPRequestHandler], List[int]]:
responses: List[Tuple[int, Optional[bytes]]],
) -> Tuple[Type[BaseHTTPRequestHandler], List[int]]:
"""Build a handler that returns each (status, body) in order for GET/PUT."""
call_count = [0]

Expand Down