RFC: from __future__ import annotations + migrate

This commit is contained in:
Ronny Pfannschmidt
2024-06-17 17:01:28 +02:00
parent 20dd1d6738
commit 9295f9ffff
242 changed files with 1961 additions and 1777 deletions

View File

@@ -1,10 +1,11 @@
# mypy: allow-untyped-defs
from __future__ import annotations
import os
import subprocess
import sys
import time
from types import ModuleType
from typing import List
from _pytest.config import ExitCode
from _pytest.config import PytestPluginManager
@@ -227,7 +228,7 @@ class TestInlineRunModulesCleanup:
def spy_factory(self):
class SysModulesSnapshotSpy:
instances: List["SysModulesSnapshotSpy"] = []
instances: list[SysModulesSnapshotSpy] = []
def __init__(self, preserve=None) -> None:
SysModulesSnapshotSpy.instances.append(self)
@@ -399,7 +400,7 @@ class TestSysPathsSnapshot:
original_data = list(getattr(sys, path_type))
original_other = getattr(sys, other_path_type)
original_other_data = list(original_other)
new: List[object] = []
new: list[object] = []
snapshot = SysPathsSnapshot()
monkeypatch.setattr(sys, path_type, new)
snapshot.restore()