From 55debfad1f690d11da3b33022d55c49060460e44 Mon Sep 17 00:00:00 2001 From: "Kian Meng, Ang" Date: Mon, 27 Dec 2021 20:23:15 +0800 Subject: [PATCH] Fix typos (#9424) --- AUTHORS | 1 + doc/en/announce/release-2.5.0.rst | 2 +- doc/en/changelog.rst | 14 +++++++------- doc/en/history.rst | 2 +- doc/en/how-to/skipping.rst | 2 +- doc/en/reference/fixtures.rst | 2 +- src/_pytest/_code/code.py | 2 +- src/_pytest/assertion/rewrite.py | 2 +- src/_pytest/assertion/util.py | 2 +- src/_pytest/config/__init__.py | 2 +- src/_pytest/config/compat.py | 2 +- src/_pytest/junitxml.py | 2 +- src/_pytest/mark/expression.py | 2 +- src/_pytest/pytester.py | 2 +- src/_pytest/python.py | 2 +- testing/acceptance_test.py | 2 +- testing/code/test_source.py | 2 +- testing/test_compat.py | 4 ++-- testing/test_config.py | 4 ++-- testing/test_doctest.py | 4 ++-- testing/test_runner.py | 2 +- testing/test_stash.py | 2 +- testing/test_warnings.py | 4 ++-- tox.ini | 4 ++-- 24 files changed, 35 insertions(+), 34 deletions(-) diff --git a/AUTHORS b/AUTHORS index 25b55e5ae..9413f9c2e 100644 --- a/AUTHORS +++ b/AUTHORS @@ -185,6 +185,7 @@ Katerina Koukiou Keri Volans Kevin Cox Kevin J. Foley +Kian-Meng Ang Kodi B. Arfer Kostis Anagnostopoulos Kristoffer Nordström diff --git a/doc/en/announce/release-2.5.0.rst b/doc/en/announce/release-2.5.0.rst index bc83fdc12..c6cdcdd8a 100644 --- a/doc/en/announce/release-2.5.0.rst +++ b/doc/en/announce/release-2.5.0.rst @@ -11,7 +11,7 @@ clear information about the circumstances and a simple example which reproduces the problem. The issue tracker is of course not empty now. We have many remaining -"enhacement" issues which we'll hopefully can tackle in 2014 with your +"enhancement" issues which we'll hopefully can tackle in 2014 with your help. For those who use older Python versions, please note that pytest is not diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index c5ccc75e3..15ac02d83 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -538,7 +538,7 @@ Bug Fixes the ``tmp_path``/``tmpdir`` fixture). Now the directories are created with private permissions. - pytest used to silenty use a pre-existing ``/tmp/pytest-of-`` directory, + pytest used to silently use a pre-existing ``/tmp/pytest-of-`` directory, even if owned by another user. This means another user could pre-create such a directory and gain control of another user's temporary directory. Now such a condition results in an error. @@ -1304,7 +1304,7 @@ Improvements is not displayed by default for passing tests. This change makes the mistake visible during testing. - You may supress this behavior temporarily or permanently by setting + You may suppress this behavior temporarily or permanently by setting ``logging.raiseExceptions = False``. @@ -1759,7 +1759,7 @@ Bug Fixes it was swallowed and ignored (regression in pytest 5.1.0). -- :issue:`6801`: Do not display empty lines inbetween traceback for unexpected exceptions with doctests. +- :issue:`6801`: Do not display empty lines in between traceback for unexpected exceptions with doctests. - :issue:`6802`: The :fixture:`testdir fixture ` works within doctests now. @@ -4628,7 +4628,7 @@ Bug Fixes - Fixed a bug where stdout and stderr were logged twice by junitxml when a test was marked xfail. (:issue:`3491`) -- Fix ``usefixtures`` mark applyed to unittest tests by correctly instantiating +- Fix ``usefixtures`` mark applied to unittest tests by correctly instantiating ``FixtureInfo``. (:issue:`3498`) - Fix assertion rewriter compatibility with libraries that monkey patch @@ -8009,7 +8009,7 @@ Bug fixes: or through plugin hooks. Also introduce a "--strict" option which will treat unregistered markers as errors allowing to avoid typos and maintain a well described set of markers - for your test suite. See exaples at http://pytest.org/en/stable/how-to/mark.html + for your test suite. See examples at http://pytest.org/en/stable/how-to/mark.html and its links. - issue50: introduce "-m marker" option to select tests based on markers (this is a stricter and more predictable version of '-k' in that "-m" @@ -8321,7 +8321,7 @@ Bug fixes: - fix issue57 -f|--looponfail to work with xpassing tests (thanks Ronny) - fix issue92 collectonly reporter and --pastebin (thanks Benjamin Peterson) - fix py.code.compile(source) to generate unique filenames -- fix assertion re-interp problems on PyPy, by defering code +- fix assertion re-interp problems on PyPy, by deferring code compilation to the (overridable) Frame.eval class. (thanks Amaury Forgeot) - fix py.path.local.pyimport() to work with directories - streamline py.path.local.mkdtemp implementation and usage @@ -8395,7 +8395,7 @@ Bug fixes: - improve support for raises and other dynamically compiled code by manipulating python's linecache.cache instead of the previous rather hacky way of creating custom code objects. This makes - it seemlessly work on Jython and PyPy where it previously didn't. + it seamlessly work on Jython and PyPy where it previously didn't. - fix issue96: make capturing more resilient against Control-C interruptions (involved somewhat substantial refactoring diff --git a/doc/en/history.rst b/doc/en/history.rst index 796a42486..bb5aa4930 100644 --- a/doc/en/history.rst +++ b/doc/en/history.rst @@ -139,7 +139,7 @@ project: which adds ``pytest`` (rather than ``py.test``) as the recommended command-line entry point -Due to this history, it's diffcult to answer the question when pytest was started. +Due to this history, it's difficult to answer the question when pytest was started. It depends what point should really be seen as the start of it all. One possible interpretation is to pick Europython 2004, i.e. around June/July 2004. diff --git a/doc/en/how-to/skipping.rst b/doc/en/how-to/skipping.rst index 9b74628d5..e2f59c77a 100644 --- a/doc/en/how-to/skipping.rst +++ b/doc/en/how-to/skipping.rst @@ -369,7 +369,7 @@ Here is a simple test file with the several usages: Running it with the report-on-xfail option gives this output: -.. FIXME: Use $ instead of ! again to reenable regendoc once it's fixed: +.. FIXME: Use $ instead of ! again to re-enable regendoc once it's fixed: https://github.com/pytest-dev/pytest/issues/8807 .. code-block:: pytest diff --git a/doc/en/reference/fixtures.rst b/doc/en/reference/fixtures.rst index 35b790212..da2c5e009 100644 --- a/doc/en/reference/fixtures.rst +++ b/doc/en/reference/fixtures.rst @@ -208,7 +208,7 @@ the one defined in ``tests/test_top.py`` would be unavailable to it because it would have to step down a level (step inside a circle) to find it. The first fixture the test finds is the one that will be used, so -:ref:`fixtures can be overriden ` if you need to change or +:ref:`fixtures can be overridden ` if you need to change or extend what one does for a particular scope. You can also use the ``conftest.py`` file to implement diff --git a/src/_pytest/_code/code.py b/src/_pytest/_code/code.py index b19ee7c64..12ce13552 100644 --- a/src/_pytest/_code/code.py +++ b/src/_pytest/_code/code.py @@ -895,7 +895,7 @@ class FormattedExcinfo: max_frames=max_frames, total=len(traceback), ) - # Type ignored because adding two instaces of a List subtype + # Type ignored because adding two instances of a List subtype # currently incorrectly has type List instead of the subtype. traceback = traceback[:max_frames] + traceback[-max_frames:] # type: ignore else: diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index 50b367e25..e9ecedfaa 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -513,7 +513,7 @@ def _call_assertion_pass(lineno: int, orig: str, expl: str) -> None: def _check_if_assertion_pass_impl() -> bool: """Check if any plugins implement the pytest_assertion_pass hook - in order not to generate explanation unecessarily (might be expensive).""" + in order not to generate explanation unnecessarily (might be expensive).""" return True if util._assertion_pass else False diff --git a/src/_pytest/assertion/util.py b/src/_pytest/assertion/util.py index c26ff90dc..14512a7c5 100644 --- a/src/_pytest/assertion/util.py +++ b/src/_pytest/assertion/util.py @@ -142,7 +142,7 @@ def has_default_eq( First, we check if the object's __eq__ attribute has __code__, if so, we check the equally of the method code filename (__code__.co_filename) - to the default onces generated by the dataclass and attr module + to the default one generated by the dataclass and attr module for dataclasses the default co_filename is , for attrs class, the __eq__ should contain "attrs eq generated" """ # inspired from https://github.com/willmcgugan/rich/blob/07d51ffc1aee6f16bd2e5a25b4e82850fb9ed778/rich/pretty.py#L68 diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py index 4cb22009a..1bdd8effb 100644 --- a/src/_pytest/config/__init__.py +++ b/src/_pytest/config/__init__.py @@ -970,7 +970,7 @@ class Config: def add_cleanup(self, func: Callable[[], None]) -> None: """Add a function to be called when the config object gets out of - use (usually coninciding with pytest_unconfigure).""" + use (usually coinciding with pytest_unconfigure).""" self._cleanup.append(func) def _do_configure(self) -> None: diff --git a/src/_pytest/config/compat.py b/src/_pytest/config/compat.py index 8f82dd9f9..ba267d215 100644 --- a/src/_pytest/config/compat.py +++ b/src/_pytest/config/compat.py @@ -23,7 +23,7 @@ class PathAwareHookProxy: this helper wraps around hook callers until pluggy supports fixingcalls, this one will do - it currently doesnt return full hook caller proxies for fixed hooks, + it currently doesn't return full hook caller proxies for fixed hooks, this may have to be changed later depending on bugs """ diff --git a/src/_pytest/junitxml.py b/src/_pytest/junitxml.py index 8249dccff..1b9e3bfec 100644 --- a/src/_pytest/junitxml.py +++ b/src/_pytest/junitxml.py @@ -256,7 +256,7 @@ class _NodeReporter: def finalize(self) -> None: data = self.to_xml() self.__dict__.clear() - # Type ignored becuase mypy doesn't like overriding a method. + # Type ignored because mypy doesn't like overriding a method. # Also the return value doesn't match... self.to_xml = lambda: data # type: ignore[assignment] diff --git a/src/_pytest/mark/expression.py b/src/_pytest/mark/expression.py index 9d57e944b..92220d772 100644 --- a/src/_pytest/mark/expression.py +++ b/src/_pytest/mark/expression.py @@ -190,7 +190,7 @@ class MatcherAdapter(Mapping[str, bool]): class Expression: """A compiled match expression as used by -k and -m. - The expression can be evaulated against different matchers. + The expression can be evaluated against different matchers. """ __slots__ = ("code",) diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index 42e71ff91..84547535d 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -1288,7 +1288,7 @@ class Pytester: ) -> Optional[Union[Item, Collector]]: """Return the collection node for name from the module collection. - Searchs a module collection node for a collection node matching the + Searches a module collection node for a collection node matching the given name. :param modcol: A module collection node; see :py:meth:`getmodulecol`. diff --git a/src/_pytest/python.py b/src/_pytest/python.py index 197d36ee9..8db9e7489 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -1655,7 +1655,7 @@ class Function(PyobjMixin, nodes.Item): # this will be redeemed later for mark in callspec.marks: # feel free to cry, this was broken for years before - # and keywords cant fix it per design + # and keywords can't fix it per design self.keywords[mark.name] = mark self.own_markers.extend(normalize_mark_list(callspec.marks)) if keywords: diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index bfd1fe6e6..8b8d4a4a6 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -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 diff --git a/testing/code/test_source.py b/testing/code/test_source.py index b7b3c1711..fd2c9fc97 100644 --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -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)") diff --git a/testing/test_compat.py b/testing/test_compat.py index 9f48a31d6..8471a1a50 100644 --- a/testing/test_compat.py +++ b/testing/test_compat.py @@ -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: diff --git a/testing/test_config.py b/testing/test_config.py index 443559116..9a57b919d 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -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) diff --git a/testing/test_doctest.py b/testing/test_doctest.py index ca215e070..e85f44f93 100644 --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -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(): ''' diff --git a/testing/test_runner.py b/testing/test_runner.py index a34cd98f9..2e2c462d9 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -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 diff --git a/testing/test_stash.py b/testing/test_stash.py index bb294f5da..2c9df4832 100644 --- a/testing/test_stash.py +++ b/testing/test_stash.py @@ -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 diff --git a/testing/test_warnings.py b/testing/test_warnings.py index 3ae9ea331..734e1ebb5 100644 --- a/testing/test_warnings.py +++ b/testing/test_warnings.py @@ -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 diff --git a/tox.ini b/tox.ini index 9d26051eb..6d30e0b0d 100644 --- a/tox.ini +++ b/tox.ini @@ -130,7 +130,7 @@ commands = {envpython} tox_run.py [testenv:release] -decription = do a release, required posarg of the version number +description = do a release, required posarg of the version number basepython = python3 usedevelop = True passenv = * @@ -144,7 +144,7 @@ deps = commands = python scripts/release.py {posargs} [testenv:prepare-release-pr] -decription = prepare a release PR from a manual trigger in GitHub actions +description = prepare a release PR from a manual trigger in GitHub actions usedevelop = {[testenv:release]usedevelop} passenv = {[testenv:release]passenv} deps = {[testenv:release]deps}