[8.2.x] Spelling (#12331)

Co-authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2024-05-15 18:25:57 +00:00
committed by GitHub
parent f179bf252f
commit bb5a1257b0
46 changed files with 100 additions and 97 deletions

View File

@@ -667,7 +667,7 @@ class TestLocalPath(CommonFSTests):
assert p == os.path.expanduser("~")
@pytest.mark.skipif(
not sys.platform.startswith("win32"), reason="case insensitive only on windows"
not sys.platform.startswith("win32"), reason="case-insensitive only on windows"
)
def test_eq_hash_are_case_insensitive_on_windows(self):
a = local("/some/path")
@@ -898,7 +898,7 @@ class TestExecutionOnWindows:
class TestExecution:
pytestmark = skiponwin32
def test_sysfind_no_permisson_ignored(self, monkeypatch, tmpdir):
def test_sysfind_no_permission_ignored(self, monkeypatch, tmpdir):
noperm = tmpdir.ensure("noperm", dir=True)
monkeypatch.setenv("PATH", str(noperm), prepend=":")
noperm.chmod(0)

View File

@@ -1515,7 +1515,7 @@ def test_cwd_deleted(pytester: Pytester) -> None:
result.stderr.no_fnmatch_line("*INTERNALERROR*")
def test_regression_nagative_line_index(pytester: Pytester) -> None:
def test_regression_negative_line_index(pytester: Pytester) -> None:
"""
With Python 3.10 alphas, there was an INTERNALERROR reported in
https://github.com/pytest-dev/pytest/pull/8227

View File

@@ -255,7 +255,7 @@ def test_getfuncsource_dynamic() -> None:
assert str(g_source).strip() == "def g():\n pass # pragma: no cover"
def test_getfuncsource_with_multine_string() -> None:
def test_getfuncsource_with_multiline_string() -> None:
def f():
c = """while True:
pass

View File

@@ -117,7 +117,7 @@ def test_change_disabled_level_undo(pytester: Pytester) -> None:
result.stdout.no_fnmatch_line("*log from test2*")
def test_change_level_undos_handler_level(pytester: Pytester) -> None:
def test_change_level_undoes_handler_level(pytester: Pytester) -> None:
"""Ensure that 'set_level' is undone after the end of the test (handler).
Issue #7569. Tests the handler level specifically.
@@ -302,7 +302,15 @@ def logging_during_setup_and_teardown(
assert [x.message for x in caplog.get_records("teardown")] == ["a_teardown_log"]
def test_caplog_captures_for_all_stages(
def private_assert_caplog_records_is_setup_call(
caplog: pytest.LogCaptureFixture,
) -> None:
# This reaches into private API, don't use this type of thing in real tests!
caplog_records = caplog._item.stash[caplog_records_key]
assert set(caplog_records) == {"setup", "call"}
def test_captures_for_all_stages(
caplog: pytest.LogCaptureFixture, logging_during_setup_and_teardown: None
) -> None:
assert not caplog.records
@@ -312,9 +320,7 @@ def test_caplog_captures_for_all_stages(
assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"]
# This reaches into private API, don't use this type of thing in real tests!
caplog_records = caplog._item.stash[caplog_records_key]
assert set(caplog_records) == {"setup", "call"}
private_assert_caplog_records_is_setup_call(caplog)
def test_clear_for_call_stage(
@@ -323,21 +329,18 @@ def test_clear_for_call_stage(
logger.info("a_call_log")
assert [x.message for x in caplog.get_records("call")] == ["a_call_log"]
assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"]
caplog_records = caplog._item.stash[caplog_records_key]
assert set(caplog_records) == {"setup", "call"}
private_assert_caplog_records_is_setup_call(caplog)
caplog.clear()
assert caplog.get_records("call") == []
assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"]
caplog_records = caplog._item.stash[caplog_records_key]
assert set(caplog_records) == {"setup", "call"}
private_assert_caplog_records_is_setup_call(caplog)
logging.info("a_call_log_after_clear")
assert [x.message for x in caplog.get_records("call")] == ["a_call_log_after_clear"]
assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"]
caplog_records = caplog._item.stash[caplog_records_key]
assert set(caplog_records) == {"setup", "call"}
private_assert_caplog_records_is_setup_call(caplog)
def test_ini_controls_global_log_level(pytester: Pytester) -> None:
@@ -363,11 +366,11 @@ def test_ini_controls_global_log_level(pytester: Pytester) -> None:
)
result = pytester.runpytest()
# make sure that that we get a '0' exit code for the testsuite
# make sure that we get a '0' exit code for the testsuite
assert result.ret == 0
def test_caplog_can_override_global_log_level(pytester: Pytester) -> None:
def test_can_override_global_log_level(pytester: Pytester) -> None:
pytester.makepyfile(
"""
import pytest
@@ -406,7 +409,7 @@ def test_caplog_can_override_global_log_level(pytester: Pytester) -> None:
assert result.ret == 0
def test_caplog_captures_despite_exception(pytester: Pytester) -> None:
def test_captures_despite_exception(pytester: Pytester) -> None:
pytester.makepyfile(
"""
import pytest

View File

@@ -933,7 +933,7 @@ class TestRequestBasic:
) -> None:
"""
Ensure exceptions raised during teardown by finalizers are suppressed
until all finalizers are called, then re-reaised together in an
until all finalizers are called, then re-raised together in an
exception group (#2440)
"""
pytester.makepyfile(

View File

@@ -163,7 +163,7 @@ class TestMockDecoration:
@mock.patch("os.path.abspath")
@mock.patch("os.path.normpath")
@mock.patch("os.path.basename", new=mock_basename)
def test_someting(normpath, abspath, tmp_path):
def test_something(normpath, abspath, tmp_path):
abspath.return_value = "this"
os.path.normpath(os.path.abspath("hello"))
normpath.assert_any_call("this")
@@ -176,7 +176,7 @@ class TestMockDecoration:
funcnames = [
call.report.location[2] for call in calls if call.report.when == "call"
]
assert funcnames == ["T.test_hello", "test_someting"]
assert funcnames == ["T.test_hello", "test_something"]
def test_mock_sorting(self, pytester: Pytester) -> None:
pytest.importorskip("mock", "1.0.1")

View File

@@ -58,7 +58,7 @@ class TestNewAPI:
assert val == -2
@pytest.mark.filterwarnings("ignore:could not create cache path")
def test_cache_writefail_cachfile_silent(self, pytester: Pytester) -> None:
def test_cache_writefail_cachefile_silent(self, pytester: Pytester) -> None:
pytester.makeini("[pytest]")
pytester.path.joinpath(".pytest_cache").write_text(
"gone wrong", encoding="utf-8"

View File

@@ -94,7 +94,7 @@ def test_get_real_func_partial() -> None:
assert get_real_func(partial(foo)) is foo
@pytest.mark.skipif(sys.version_info >= (3, 11), reason="couroutine removed")
@pytest.mark.skipif(sys.version_info >= (3, 11), reason="coroutine removed")
def test_is_generator_asyncio(pytester: Pytester) -> None:
pytester.makepyfile(
"""

View File

@@ -217,7 +217,7 @@ class TestParseIni:
def test_confcutdir_default_without_configfile(self, pytester: Pytester) -> None:
# If --confcutdir is not specified, and there is no configfile, default
# to the roothpath.
# to the rootpath.
sub = pytester.mkdir("sub")
os.chdir(sub)
config = pytester.parseconfigure()
@@ -1740,7 +1740,7 @@ class TestOverrideIniArgs:
)
pytester.makepyfile(
r"""
def test_overriden(pytestconfig):
def test_overridden(pytestconfig):
config_paths = pytestconfig.getini("paths")
print(config_paths)
for cpf in config_paths:

View File

@@ -70,7 +70,7 @@ class TestConftestValueAccessGlobal:
)
assert conftest._rget_with_confmod("a", p)[1] == 1
def test_immediate_initialiation_and_incremental_are_the_same(
def test_immediate_initialization_and_incremental_are_the_same(
self, basedir: Path
) -> None:
conftest = PytestPluginManager()
@@ -396,7 +396,7 @@ def test_conftest_symlink_files(pytester: Pytester) -> None:
@pytest.mark.skipif(
os.path.normcase("x") != os.path.normcase("X"),
reason="only relevant for case insensitive file systems",
reason="only relevant for case-insensitive file systems",
)
def test_conftest_badcase(pytester: Pytester) -> None:
"""Check conftest.py loading when directory casing is wrong (#5792)."""

View File

@@ -1122,7 +1122,7 @@ class TestTraceOption:
def test_trace_after_runpytest(pytester: Pytester) -> None:
"""Test that debugging's pytest_configure is re-entrant."""
"""Test that debugging's pytest_configure is reentrant."""
p1 = pytester.makepyfile(
"""
from _pytest.debugging import pytestPDB
@@ -1153,7 +1153,7 @@ def test_trace_after_runpytest(pytester: Pytester) -> None:
def test_quit_with_swallowed_SystemExit(pytester: Pytester) -> None:
"""Test that debugging's pytest_configure is re-entrant."""
"""Test that debugging's pytest_configure is reentrant."""
p1 = pytester.makepyfile(
"""
def call_pdb_set_trace():

View File

@@ -396,7 +396,7 @@ class TestDoctests:
]
)
def test_doctest_no_linedata_on_overriden_property(self, pytester: Pytester):
def test_doctest_no_linedata_on_overridden_property(self, pytester: Pytester):
pytester.makepyfile(
"""
class Sample(object):
@@ -414,7 +414,7 @@ class TestDoctests:
result.stdout.fnmatch_lines(
[
"*= FAILURES =*",
"*_ [[]doctest[]] test_doctest_no_linedata_on_overriden_property.Sample.some_property _*",
"*_ [[]doctest[]] test_doctest_no_linedata_on_overridden_property.Sample.some_property _*",
"EXAMPLE LOCATION UNKNOWN, not showing all tests of that example",
"[?][?][?] >>> Sample().some_property",
"Expected:",
@@ -422,7 +422,7 @@ class TestDoctests:
"Got:",
" 'something'",
"",
"*/test_doctest_no_linedata_on_overriden_property.py:None: DocTestFailure",
"*/test_doctest_no_linedata_on_overridden_property.py:None: DocTestFailure",
"*= 1 failed in *",
]
)

View File

@@ -1002,7 +1002,7 @@ class TestNonPython:
@pytest.mark.parametrize("junit_logging", ["no", "system-out"])
def test_nullbyte(pytester: Pytester, junit_logging: str) -> None:
# A null byte can not occur in XML (see section 2.2 of the spec)
# A null byte cannot occur in XML (see section 2.2 of the spec)
pytester.makepyfile(
"""
import sys

View File

@@ -155,7 +155,7 @@ def test_override_ini_paths(pytester: pytest.Pytester) -> None:
)
pytester.makepyfile(
r"""
def test_overriden(pytestconfig):
def test_overridden(pytestconfig):
config_paths = pytestconfig.getini("paths")
print(config_paths)
for cpf in config_paths:

View File

@@ -61,7 +61,7 @@ def test_basic(expr: str, expected: bool) -> None:
("not not not not not true", False),
),
)
def test_syntax_oddeties(expr: str, expected: bool) -> None:
def test_syntax_oddities(expr: str, expected: bool) -> None:
matcher = {"true": True, "false": False}.__getitem__
assert evaluate(expr, matcher) is expected

View File

@@ -420,7 +420,7 @@ class TestPytestPluginManager:
pytestpm.consider_conftest(mod, registration_name="unused")
class TestPytestPluginManagerBootstrapming:
class TestPytestPluginManagerBootstrapping:
def test_preparse_args(self, pytestpm: PytestPluginManager) -> None:
pytest.raises(
ImportError, lambda: pytestpm.consider_preparse(["xyz", "-p", "hello123"])
@@ -446,7 +446,7 @@ class TestPytestPluginManagerBootstrapming:
assert len(l2) == len(l1)
assert 42 not in l2
def test_plugin_prevent_register_unregistered_alredy_registered(
def test_plugin_prevent_register_unregistered_already_registered(
self, pytestpm: PytestPluginManager
) -> None:
pytestpm.register(42, name="abc")

View File

@@ -409,7 +409,7 @@ class BaseFunctionalTests:
# assert rep.outcome.when == "setup"
# assert rep.outcome.where.lineno == 3
# assert rep.outcome.where.path.basename == "test_func.py"
# assert instanace(rep.failed.failurerepr, PythonFailureRepr)
# assert isinstance(rep.failed.failurerepr, PythonFailureRepr)
def test_systemexit_does_not_bail_out(self, pytester: Pytester) -> None:
try:

View File

@@ -926,7 +926,7 @@ class TestTerminalFunctional:
def test_header_absolute_testpath(
self, pytester: Pytester, monkeypatch: MonkeyPatch
) -> None:
"""Regresstion test for #7814."""
"""Regression test for #7814."""
tests = pytester.path.joinpath("tests")
tests.mkdir()
pytester.makepyprojecttoml(

View File

@@ -299,7 +299,7 @@ def test_setup_setUpClass(pytester: Pytester) -> None:
@classmethod
def tearDownClass(cls):
cls.x -= 1
def test_teareddown():
def test_torn_down():
assert MyTestCase.x == 0
"""
)
@@ -346,7 +346,7 @@ def test_setup_class(pytester: Pytester) -> None:
assert self.x == 1
def teardown_class(cls):
cls.x -= 1
def test_teareddown():
def test_torn_down():
assert MyTestCase.x == 0
"""
)
@@ -881,7 +881,7 @@ def test_non_unittest_no_setupclass_support(pytester: Pytester) -> None:
def tearDownClass(cls):
cls.x = 1
def test_not_teareddown():
def test_not_torn_down():
assert TestFoo.x == 0
"""