Use from __future__ import annotations
Allows us to use more modern typing.
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
from typing import Tuple
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -1528,7 +1527,7 @@ class TestLocking:
|
||||
result.assert_outcomes(passed=(48 if scope != "each" else 48 * 2))
|
||||
|
||||
|
||||
def parse_tests_and_workers_from_output(lines: List[str]) -> List[Tuple[str, str, str]]:
|
||||
def parse_tests_and_workers_from_output(lines: list[str]) -> list[tuple[str, str, str]]:
|
||||
result = []
|
||||
for line in lines:
|
||||
# example match: "[gw0] PASSED test_a.py::test[7]"
|
||||
@@ -1550,9 +1549,9 @@ def parse_tests_and_workers_from_output(lines: List[str]) -> List[Tuple[str, str
|
||||
|
||||
|
||||
def get_workers_and_test_count_by_prefix(
|
||||
prefix: str, lines: List[str], expected_status: str = "PASSED"
|
||||
) -> Dict[str, int]:
|
||||
result: Dict[str, int] = {}
|
||||
prefix: str, lines: list[str], expected_status: str = "PASSED"
|
||||
) -> dict[str, int]:
|
||||
result: dict[str, int] = {}
|
||||
for worker, status, nodeid in parse_tests_and_workers_from_output(lines):
|
||||
if expected_status == status and nodeid.startswith(prefix):
|
||||
result[worker] = result.get(worker, 0) + 1
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import shutil
|
||||
from typing import List
|
||||
|
||||
import execnet
|
||||
import pytest
|
||||
@@ -41,7 +42,7 @@ def specssh(request) -> str:
|
||||
|
||||
|
||||
# configuration information for tests
|
||||
def getgspecs(config) -> List[execnet.XSpec]:
|
||||
def getgspecs(config) -> list[execnet.XSpec]:
|
||||
return [execnet.XSpec(spec) for spec in config.getvalueorskip("gspecs")]
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import pathlib
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import tempfile
|
||||
import textwrap
|
||||
from typing import List
|
||||
import unittest.mock
|
||||
|
||||
import pytest
|
||||
@@ -75,7 +76,7 @@ class TestStatRecorder:
|
||||
# make check()'s visit() call return our just removed
|
||||
# path as if we were in a race condition
|
||||
dirname = str(tmp)
|
||||
dirnames: List[str] = []
|
||||
dirnames: list[str] = []
|
||||
filenames = [str(p)]
|
||||
with unittest.mock.patch(
|
||||
"os.walk", return_value=[(dirname, dirnames, filenames)], autospec=True
|
||||
|
||||
Reference in New Issue
Block a user