Fix check_untyped_defs errors in capture
This commit is contained in:
parent
0267b25c66
commit
1787bffda0
|
@ -12,6 +12,7 @@ from tempfile import TemporaryFile
|
|||
|
||||
import pytest
|
||||
from _pytest.compat import CaptureIO
|
||||
from _pytest.fixtures import FixtureRequest
|
||||
|
||||
patchsysdict = {0: "stdin", 1: "stdout", 2: "stderr"}
|
||||
|
||||
|
@ -241,13 +242,12 @@ class CaptureManager:
|
|||
capture_fixtures = {"capfd", "capfdbinary", "capsys", "capsysbinary"}
|
||||
|
||||
|
||||
def _ensure_only_one_capture_fixture(request, name):
|
||||
fixtures = set(request.fixturenames) & capture_fixtures - {name}
|
||||
def _ensure_only_one_capture_fixture(request: FixtureRequest, name):
|
||||
fixtures = sorted(set(request.fixturenames) & capture_fixtures - {name})
|
||||
if fixtures:
|
||||
fixtures = sorted(fixtures)
|
||||
fixtures = fixtures[0] if len(fixtures) == 1 else fixtures
|
||||
arg = fixtures[0] if len(fixtures) == 1 else fixtures
|
||||
raise request.raiseerror(
|
||||
"cannot use {} and {} at the same time".format(fixtures, name)
|
||||
"cannot use {} and {} at the same time".format(arg, name)
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ import subprocess
|
|||
import sys
|
||||
import textwrap
|
||||
from io import UnsupportedOperation
|
||||
from typing import List
|
||||
from typing import TextIO
|
||||
|
||||
import py
|
||||
|
||||
|
@ -857,8 +859,8 @@ def tmpfile(testdir):
|
|||
|
||||
|
||||
@needsosdup
|
||||
def test_dupfile(tmpfile):
|
||||
flist = []
|
||||
def test_dupfile(tmpfile) -> None:
|
||||
flist = [] # type: List[TextIO]
|
||||
for i in range(5):
|
||||
nf = capture.safe_text_dupfile(tmpfile, "wb")
|
||||
assert nf != tmpfile
|
||||
|
|
Loading…
Reference in New Issue