fixup: remove remove unused alias in code
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
# mypy: allow-untyped-defs
|
||||
from __future__ import annotations
|
||||
|
||||
import ast
|
||||
import errno
|
||||
from functools import partial
|
||||
@@ -12,12 +14,8 @@ import stat
|
||||
import sys
|
||||
import textwrap
|
||||
from typing import cast
|
||||
from typing import Dict
|
||||
from typing import Generator
|
||||
from typing import List
|
||||
from typing import Mapping
|
||||
from typing import Optional
|
||||
from typing import Set
|
||||
from unittest import mock
|
||||
import zipfile
|
||||
|
||||
@@ -45,13 +43,13 @@ def rewrite(src: str) -> ast.Module:
|
||||
|
||||
|
||||
def getmsg(
|
||||
f, extra_ns: Optional[Mapping[str, object]] = None, *, must_pass: bool = False
|
||||
) -> Optional[str]:
|
||||
f, extra_ns: Mapping[str, object] | None = None, *, must_pass: bool = False
|
||||
) -> str | None:
|
||||
"""Rewrite the assertions in f, run it, and get the failure message."""
|
||||
src = "\n".join(_pytest._code.Code.from_function(f).source().lines)
|
||||
mod = rewrite(src)
|
||||
code = compile(mod, "<test>", "exec")
|
||||
ns: Dict[str, object] = {}
|
||||
ns: dict[str, object] = {}
|
||||
if extra_ns is not None:
|
||||
ns.update(extra_ns)
|
||||
exec(code, ns)
|
||||
@@ -1639,8 +1637,8 @@ class TestEarlyRewriteBailout:
|
||||
"""
|
||||
import importlib.machinery
|
||||
|
||||
self.find_spec_calls: List[str] = []
|
||||
self.initial_paths: Set[Path] = set()
|
||||
self.find_spec_calls: list[str] = []
|
||||
self.initial_paths: set[Path] = set()
|
||||
|
||||
class StubSession:
|
||||
_initialpaths = self.initial_paths
|
||||
@@ -2060,7 +2058,7 @@ class TestReprSizeVerbosity:
|
||||
)
|
||||
def test_get_maxsize_for_saferepr(self, verbose: int, expected_size) -> None:
|
||||
class FakeConfig:
|
||||
def get_verbosity(self, verbosity_type: Optional[str] = None) -> int:
|
||||
def get_verbosity(self, verbosity_type: str | None = None) -> int:
|
||||
return verbose
|
||||
|
||||
config = FakeConfig()
|
||||
|
||||
Reference in New Issue
Block a user