Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👷 Add Python 3.10 beta to the CI #1682

Merged
merged 6 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ flake8-pie==0.5.*
isort==5.*
mypy
types-certifi
pytest==5.*
pytest==6.*
pytest-asyncio
pytest-trio
trio
Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
PrivateFormat,
load_pem_private_key,
)
from typing_extensions import Literal
from uvicorn.config import Config
from uvicorn.main import Server

Expand Down Expand Up @@ -164,7 +165,7 @@ async def redirect_301(scope, receive, send):
await send({"type": "http.response.body"})


SERVER_SCOPE = "session"
SERVER_SCOPE: Literal["session"] = "session"
Copy link
Member

@tomchristie tomchristie Jun 14, 2021

Choose a reason for hiding this comment

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

Few questions, for thoroughness. 😁

  • What's prompting this change?
  • Is it strictly necessary for us to type this variable, here?
  • Do we have a build failure without it?
  • Can it simply be str?

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

It's precisely because it identifies it as str that we need it. This is the mypy issue:

+ mypy httpx tests
tests/conftest.py:170: error: No overload variant of "fixture" matches argument type "str"
tests/conftest.py:170: note: Possible overload variant:
tests/conftest.py:170: note:     def fixture(fixture_function: None = ..., *, scope: Union[Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']], Callable[[str, Config], Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']]]] = ..., params: Optional[Iterable[object]] = ..., autouse: bool = ..., ids: Union[Iterable[Union[None, str, float, int, bool]], Callable[[Any], Optional[object]], None] = ..., name: Optional[str] = ...) -> FixtureFunctionMarker
tests/conftest.py:170: note:     <1 more non-matching overload not shown>
tests/conftest.py:175: error: No overload variant of "fixture" matches argument type "str"
tests/conftest.py:175: note: Possible overload variant:
tests/conftest.py:175: note:     def fixture(fixture_function: None = ..., *, scope: Union[Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']], Callable[[str, Config], Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']]]] = ..., params: Optional[Iterable[object]] = ..., autouse: bool = ..., ids: Union[Iterable[Union[None, str, float, int, bool]], Callable[[Any], Optional[object]], None] = ..., name: Optional[str] = ...) -> FixtureFunctionMarker
tests/conftest.py:175: note:     <1 more non-matching overload not shown>
tests/conftest.py:181: error: No overload variant of "fixture" matches argument type "str"
tests/conftest.py:181: note: Possible overload variant:
tests/conftest.py:181: note:     def fixture(fixture_function: None = ..., *, scope: Union[Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']], Callable[[str, Config], Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']]]] = ..., params: Optional[Iterable[object]] = ..., autouse: bool = ..., ids: Union[Iterable[Union[None, str, float, int, bool]], Callable[[Any], Optional[object]], None] = ..., name: Optional[str] = ...) -> FixtureFunctionMarker
tests/conftest.py:181: note:     <1 more non-matching overload not shown>
tests/conftest.py:186: error: No overload variant of "fixture" matches argument type "str"
tests/conftest.py:186: note: Possible overload variant:
tests/conftest.py:186: note:     def fixture(fixture_function: None = ..., *, scope: Union[Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']], Callable[[str, Config], Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']]]] = ..., params: Optional[Iterable[object]] = ..., autouse: bool = ..., ids: Union[Iterable[Union[None, str, float, int, bool]], Callable[[Any], Optional[object]], None] = ..., name: Optional[str] = ...) -> FixtureFunctionMarker
tests/conftest.py:186: note:     <1 more non-matching overload not shown>
tests/conftest.py:192: error: No overload variant of "fixture" matches argument type "str"
tests/conftest.py:192: note: Possible overload variant:
tests/conftest.py:192: note:     def fixture(fixture_function: None = ..., *, scope: Union[Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']], Callable[[str, Config], Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']]]] = ..., params: Optional[Iterable[object]] = ..., autouse: bool = ..., ids: Union[Iterable[Union[None, str, float, int, bool]], Callable[[Any], Optional[object]], None] = ..., name: Optional[str] = ...) -> FixtureFunctionMarker
tests/conftest.py:192: note:     <1 more non-matching overload not shown>
tests/conftest.py:198: error: No overload variant of "fixture" matches argument type "str"
tests/conftest.py:198: note: Possible overload variant:
tests/conftest.py:198: note:     def fixture(fixture_function: None = ..., *, scope: Union[Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']], Callable[[str, Config], Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']]]] = ..., params: Optional[Iterable[object]] = ..., autouse: bool = ..., ids: Union[Iterable[Union[None, str, float, int, bool]], Callable[[Any], Optional[object]], None] = ..., name: Optional[str] = ...) -> FixtureFunctionMarker
tests/conftest.py:198: note:     <1 more non-matching overload not shown>
tests/conftest.py:274: error: No overload variant of "fixture" matches argument type "str"
tests/conftest.py:274: note: Possible overload variant:
tests/conftest.py:274: note:     def fixture(fixture_function: None = ..., *, scope: Union[Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']], Callable[[str, Config], Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']]]] = ..., params: Optional[Iterable[object]] = ..., autouse: bool = ..., ids: Union[Iterable[Union[None, str, float, int, bool]], Callable[[Any], Optional[object]], None] = ..., name: Optional[str] = ...) -> FixtureFunctionMarker
tests/conftest.py:274: note:     <1 more non-matching overload not shown>
tests/conftest.py:281: error: No overload variant of "fixture" matches argument type "str"
tests/conftest.py:281: note: Possible overload variant:
tests/conftest.py:281: note:     def fixture(fixture_function: None = ..., *, scope: Union[Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']], Callable[[str, Config], Union[Literal['session'], Literal['package'], Literal['module'], Literal['class'], Literal['function']]]] = ..., params: Optional[Iterable[object]] = ..., autouse: bool = ..., ids: Union[Iterable[Union[None, str, float, int, bool]], Callable[[Any], Optional[object]], None] = ..., name: Optional[str] = ...) -> FixtureFunctionMarker
tests/conftest.py:281: note:     <1 more non-matching overload not shown>
Found 8 errors in 1 file (checked 57 source files)

Do you have an alternative suggestion?

Copy link
Member

Choose a reason for hiding this comment

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

Do you have an alternative suggestion?

Nope. Just making sure I understand e'rything going in, and we've got a super clear history in place throughout. 😀



@pytest.fixture(scope=SERVER_SCOPE)
Expand Down