This commit is contained in:
Kian Meng, Ang
2021-12-27 20:23:15 +08:00
committed by GitHub
parent 7a42db2bf0
commit 55debfad1f
24 changed files with 35 additions and 34 deletions

View File

@@ -1281,7 +1281,7 @@ def test_tee_stdio_captures_and_live_prints(pytester: Pytester) -> None:
reason="Windows raises `OSError: [Errno 22] Invalid argument` instead",
)
def test_no_brokenpipeerror_message(pytester: Pytester) -> None:
"""Ensure that the broken pipe error message is supressed.
"""Ensure that the broken pipe error message is suppressed.
In some Python versions, it reaches sys.unraisablehook, in others
a BrokenPipeError exception is propagated, but either way it prints

View File

@@ -483,7 +483,7 @@ def test_source_with_decorator() -> None:
src = inspect.getsource(deco_fixture)
assert src == " @pytest.fixture\n def deco_fixture():\n assert False\n"
# currenly Source does not unwrap decorators, testing the
# currently Source does not unwrap decorators, testing the
# existing behavior here for explicitness, but perhaps we should revisit/change this
# in the future
assert str(Source(deco_fixture)).startswith("@functools.wraps(function)")

View File

@@ -156,11 +156,11 @@ class ErrorsHelper:
@property
def raise_exception(self):
raise Exception("exception should be catched")
raise Exception("exception should be caught")
@property
def raise_fail_outcome(self):
pytest.fail("fail should be catched")
pytest.fail("fail should be caught")
def test_helper_failures() -> None:

View File

@@ -386,7 +386,7 @@ class TestParseIni:
pytest.param(
"""
[some_other_header]
required_plugins = wont be triggered
required_plugins = won't be triggered
[pytest]
""",
"1.5",
@@ -807,7 +807,7 @@ class TestConfigAPI:
with pytest.raises(pytest.UsageError, match=exp_match):
pytester.parseconfig("--confcutdir", pytester.path.joinpath("file"))
with pytest.raises(pytest.UsageError, match=exp_match):
pytester.parseconfig("--confcutdir", pytester.path.joinpath("inexistant"))
pytester.parseconfig("--confcutdir", pytester.path.joinpath("nonexistent"))
p = pytester.mkdir("dir")
config = pytester.parseconfig("--confcutdir", p)

View File

@@ -80,7 +80,7 @@ class TestDoctests:
'# Empty'
def my_func():
">>> magic = 42 "
def unuseful():
def useless():
'''
# This is a function
# >>> # it doesn't have any doctest
@@ -564,7 +564,7 @@ class TestDoctests:
>>> magic - 42
0
'''
def unuseful():
def useless():
pass
def another():
'''

View File

@@ -287,7 +287,7 @@ class BaseFunctionalTests:
def test_func():
import sys
# on python2 exc_info is keept till a function exits
# on python2 exc_info is kept till a function exits
# so we would end up calling test functions while
# sys.exc_info would return the indexerror
# from guessing the lastitem

View File

@@ -56,7 +56,7 @@ def test_stash() -> None:
with pytest.raises(AttributeError):
stash.foo = "nope" # type: ignore[attr-defined]
# No interaction with anoter stash.
# No interaction with another stash.
stash2 = Stash()
key3 = StashKey[int]()
assert key2 not in stash2

View File

@@ -289,7 +289,7 @@ def test_warning_recorded_hook(pytester: Pytester) -> None:
assert collected_result[2] == expected_result[2], str(collected)
# NOTE: collected_result[3] is location, which differs based on the platform you are on
# thus, the best we can do here is assert the types of the paremeters match what we expect
# thus, the best we can do here is assert the types of the parameters match what we expect
# and not try and preload it in the expected array
if collected_result[3] is not None:
assert type(collected_result[3][0]) is str, str(collected)
@@ -708,7 +708,7 @@ class TestStackLevel:
pytester.parseconfig("--help")
# with stacklevel=2 the warning should originate from config._preparse and is
# thrown by an errorneous conftest.py
# thrown by an erroneous conftest.py
assert len(capwarn.captured) == 1
warning, location = capwarn.captured.pop()
file, _, func = location