[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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
46 changed files with 100 additions and 97 deletions

View File

@ -62,7 +62,7 @@ New Features
- new "-q" option which decreases verbosity and prints a more - new "-q" option which decreases verbosity and prints a more
nose/unittest-style "dot" output. nose/unittest-style "dot" output.
- many many more detailed improvements details - many, many, more detailed improvements details
Fixes Fixes
----------------------- -----------------------
@ -109,7 +109,7 @@ Important Notes
in conftest.py files. They will cause nothing special. in conftest.py files. They will cause nothing special.
- removed support for calling the pre-1.0 collection API of "run()" and "join" - removed support for calling the pre-1.0 collection API of "run()" and "join"
- removed reading option values from conftest.py files or env variables. - removed reading option values from conftest.py files or env variables.
This can now be done much much better and easier through the ini-file This can now be done much, much, better and easier through the ini-file
mechanism and the "addopts" entry in particular. mechanism and the "addopts" entry in particular.
- removed the "disabled" attribute in test classes. Use the skipping - removed the "disabled" attribute in test classes. Use the skipping
and pytestmark mechanism to skip or xfail a test class. and pytestmark mechanism to skip or xfail a test class.

View File

@ -4,7 +4,7 @@ pytest-2.2.2: bug fixes
pytest-2.2.2 (updated to 2.2.3 to fix packaging issues) is a minor pytest-2.2.2 (updated to 2.2.3 to fix packaging issues) is a minor
backward-compatible release of the versatile py.test testing tool. It backward-compatible release of the versatile py.test testing tool. It
contains bug fixes and a few refinements particularly to reporting with contains bug fixes and a few refinements particularly to reporting with
"--collectonly", see below for betails. "--collectonly", see below for details.
For general information see here: For general information see here:

View File

@ -181,7 +181,7 @@ Bug fixes:
partially failed (finalizers would not always be called before) partially failed (finalizers would not always be called before)
- fix issue320 - fix class scope for fixtures when mixed with - fix issue320 - fix class scope for fixtures when mixed with
module-level functions. Thanks Anatloy Bubenkoff. module-level functions. Thanks Anatoly Bubenkoff.
- you can specify "-q" or "-qq" to get different levels of "quieter" - you can specify "-q" or "-qq" to get different levels of "quieter"
reporting (thanks Katarzyna Jachim) reporting (thanks Katarzyna Jachim)

View File

@ -83,7 +83,7 @@ holger krekel
Thanks Ralph Schmitt for the precise failure example. Thanks Ralph Schmitt for the precise failure example.
- fix issue244 by implementing special index for parameters to only use - fix issue244 by implementing special index for parameters to only use
indices for paramentrized test ids indices for parametrized test ids
- fix issue287 by running all finalizers but saving the exception - fix issue287 by running all finalizers but saving the exception
from the first failing finalizer and re-raising it so teardown will from the first failing finalizer and re-raising it so teardown will

View File

@ -73,7 +73,7 @@ holger krekel
- cleanup setup.py a bit and specify supported versions. Thanks Jurko - cleanup setup.py a bit and specify supported versions. Thanks Jurko
Gospodnetic for the PR. Gospodnetic for the PR.
- change XPASS colour to yellow rather then red when tests are run - change XPASS colour to yellow rather than red when tests are run
with -v. with -v.
- fix issue473: work around mock putting an unbound method into a class - fix issue473: work around mock putting an unbound method into a class

View File

@ -55,7 +55,7 @@ holger krekel
github. See https://pytest.org/en/stable/contributing.html . github. See https://pytest.org/en/stable/contributing.html .
Thanks to Anatoly for pushing and initial work on this. Thanks to Anatoly for pushing and initial work on this.
- fix issue650: new option ``--docttest-ignore-import-errors`` which - fix issue650: new option ``--doctest-ignore-import-errors`` which
will turn import errors in doctests into skips. Thanks Charles Cloud will turn import errors in doctests into skips. Thanks Charles Cloud
for the complete PR. for the complete PR.

View File

@ -49,7 +49,7 @@ place on 20th, 21st, 22nd, 24th and 25th. On the 23rd we took a break
day for some hot hiking in the Black Forest. day for some hot hiking in the Black Forest.
Sprint activity was organised heavily around pairing, with plenty of group Sprint activity was organised heavily around pairing, with plenty of group
discusssions to take advantage of the high bandwidth, and lightning talks discussions to take advantage of the high bandwidth, and lightning talks
as well. as well.

View File

@ -168,7 +168,7 @@ Improvements
- `#11311 <https://github.com/pytest-dev/pytest/issues/11311>`_: When using ``--override-ini`` for paths in invocations without a configuration file defined, the current working directory is used - `#11311 <https://github.com/pytest-dev/pytest/issues/11311>`_: When using ``--override-ini`` for paths in invocations without a configuration file defined, the current working directory is used
as the relative directory. as the relative directory.
Previoulsy this would raise an :class:`AssertionError`. Previously this would raise an :class:`AssertionError`.
- `#11475 <https://github.com/pytest-dev/pytest/issues/11475>`_: :ref:`--import-mode=importlib <import-mode-importlib>` now tries to import modules using the standard import mechanism (but still without changing :py:data:`sys.path`), falling back to importing modules directly only if that fails. - `#11475 <https://github.com/pytest-dev/pytest/issues/11475>`_: :ref:`--import-mode=importlib <import-mode-importlib>` now tries to import modules using the standard import mechanism (but still without changing :py:data:`sys.path`), falling back to importing modules directly only if that fails.
@ -1411,7 +1411,7 @@ Deprecations
``__init__`` method, they should take ``**kwargs``. See ``__init__`` method, they should take ``**kwargs``. See
:ref:`uncooperative-constructors-deprecated` for details. :ref:`uncooperative-constructors-deprecated` for details.
Note that a deprection warning is only emitted when there is a conflict in the Note that a deprecation warning is only emitted when there is a conflict in the
arguments pytest expected to pass. This deprecation was already part of pytest arguments pytest expected to pass. This deprecation was already part of pytest
7.0.0rc1 but wasn't documented. 7.0.0rc1 but wasn't documented.
@ -1453,7 +1453,7 @@ Breaking Changes
- `#7259 <https://github.com/pytest-dev/pytest/issues/7259>`_: The :ref:`Node.reportinfo() <non-python tests>` function first return value type has been expanded from `py.path.local | str` to `os.PathLike[str] | str`. - `#7259 <https://github.com/pytest-dev/pytest/issues/7259>`_: The :ref:`Node.reportinfo() <non-python tests>` function first return value type has been expanded from `py.path.local | str` to `os.PathLike[str] | str`.
Most plugins which refer to `reportinfo()` only define it as part of a custom :class:`pytest.Item` implementation. Most plugins which refer to `reportinfo()` only define it as part of a custom :class:`pytest.Item` implementation.
Since `py.path.local` is an `os.PathLike[str]`, these plugins are unaffacted. Since `py.path.local` is an `os.PathLike[str]`, these plugins are unaffected.
Plugins and users which call `reportinfo()`, use the first return value and interact with it as a `py.path.local`, would need to adjust by calling `py.path.local(fspath)`. Plugins and users which call `reportinfo()`, use the first return value and interact with it as a `py.path.local`, would need to adjust by calling `py.path.local(fspath)`.
Although preferably, avoid the legacy `py.path.local` and use `pathlib.Path`, or use `item.location` or `item.path`, instead. Although preferably, avoid the legacy `py.path.local` and use `pathlib.Path`, or use `item.location` or `item.path`, instead.
@ -1961,7 +1961,7 @@ Bug Fixes
the ``tmp_path``/``tmpdir`` fixture). Now the directories are created with the ``tmp_path``/``tmpdir`` fixture). Now the directories are created with
private permissions. private permissions.
pytest used to silently use a pre-existing ``/tmp/pytest-of-<username>`` directory, pytest used to silently use a preexisting ``/tmp/pytest-of-<username>`` directory,
even if owned by another user. This means another user could pre-create such a 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 directory and gain control of another user's temporary directory. Now such a
condition results in an error. condition results in an error.
@ -2688,7 +2688,7 @@ Features
also changes ``sys.modules`` as a side-effect), which works but has a number of drawbacks, like requiring test modules also changes ``sys.modules`` as a side-effect), which works but has a number of drawbacks, like requiring test modules
that don't live in packages to have unique names (as they need to reside under a unique name in ``sys.modules``). that don't live in packages to have unique names (as they need to reside under a unique name in ``sys.modules``).
``--import-mode=importlib`` uses more fine grained import mechanisms from ``importlib`` which don't ``--import-mode=importlib`` uses more fine-grained import mechanisms from ``importlib`` which don't
require pytest to change ``sys.path`` or ``sys.modules`` at all, eliminating much of the drawbacks require pytest to change ``sys.path`` or ``sys.modules`` at all, eliminating much of the drawbacks
of the previous mode. of the previous mode.
@ -2705,7 +2705,7 @@ Improvements
------------ ------------
- :issue:`4375`: The ``pytest`` command now suppresses the ``BrokenPipeError`` error message that - :issue:`4375`: The ``pytest`` command now suppresses the ``BrokenPipeError`` error message that
is printed to stderr when the output of ``pytest`` is piped and and the pipe is is printed to stderr when the output of ``pytest`` is piped and the pipe is
closed by the piped-to program (common examples are ``less`` and ``head``). closed by the piped-to program (common examples are ``less`` and ``head``).
@ -3007,7 +3007,7 @@ Breaking Changes
This hook has been marked as deprecated and not been even called by pytest for over 10 years now. This hook has been marked as deprecated and not been even called by pytest for over 10 years now.
- :issue:`6673`: Reversed / fix meaning of "+/-" in error diffs. "-" means that sth. expected is missing in the result and "+" means that there are unexpected extras in the result. - :issue:`6673`: Reversed / fix meaning of "+/-" in error diffs. "-" means that something expected is missing in the result and "+" means that there are unexpected extras in the result.
- :issue:`6737`: The ``cached_result`` attribute of ``FixtureDef`` is now set to ``None`` when - :issue:`6737`: The ``cached_result`` attribute of ``FixtureDef`` is now set to ``None`` when
@ -4612,7 +4612,7 @@ Bug Fixes
Improved Documentation Improved Documentation
---------------------- ----------------------
- :issue:`4974`: Update docs for ``pytest_cmdline_parse`` hook to note availability liminations - :issue:`4974`: Update docs for ``pytest_cmdline_parse`` hook to note availability limitations
@ -6470,7 +6470,7 @@ Features
Bug Fixes Bug Fixes
--------- ---------
- Fix hanging pexpect test on MacOS by using flush() instead of wait(). - Fix hanging pexpect test on macOS by using flush() instead of wait().
(:issue:`2022`) (:issue:`2022`)
- Fix restoring Python state after in-process pytest runs with the - Fix restoring Python state after in-process pytest runs with the
@ -6518,7 +6518,7 @@ Trivial/Internal Changes
------------------------ ------------------------
- Show a simple and easy error when keyword expressions trigger a syntax error - Show a simple and easy error when keyword expressions trigger a syntax error
(for example, ``"-k foo and import"`` will show an error that you can not use (for example, ``"-k foo and import"`` will show an error that you cannot use
the ``import`` keyword in expressions). (:issue:`2953`) the ``import`` keyword in expressions). (:issue:`2953`)
- Change parametrized automatic test id generation to use the ``__name__`` - Change parametrized automatic test id generation to use the ``__name__``
@ -8294,7 +8294,7 @@ time or change existing behaviors in order to make them less surprising/more use
one will also have a "reprec" attribute with the recorded events/reports. one will also have a "reprec" attribute with the recorded events/reports.
- fix monkeypatch.setattr("x.y", raising=False) to actually not raise - fix monkeypatch.setattr("x.y", raising=False) to actually not raise
if "y" is not a pre-existing attribute. Thanks Florian Bruhin. if "y" is not a preexisting attribute. Thanks Florian Bruhin.
- fix issue741: make running output from testdir.run copy/pasteable - fix issue741: make running output from testdir.run copy/pasteable
Thanks Bruno Oliveira. Thanks Bruno Oliveira.
@ -8350,7 +8350,7 @@ time or change existing behaviors in order to make them less surprising/more use
- fix issue854: autouse yield_fixtures defined as class members of - fix issue854: autouse yield_fixtures defined as class members of
unittest.TestCase subclasses now work as expected. unittest.TestCase subclasses now work as expected.
Thannks xmo-odoo for the report and Bruno Oliveira for the PR. Thanks xmo-odoo for the report and Bruno Oliveira for the PR.
- fix issue833: --fixtures now shows all fixtures of collected test files, instead of just the - fix issue833: --fixtures now shows all fixtures of collected test files, instead of just the
fixtures declared on the first one. fixtures declared on the first one.
@ -8454,7 +8454,7 @@ time or change existing behaviors in order to make them less surprising/more use
github. See https://pytest.org/en/stable/contributing.html . github. See https://pytest.org/en/stable/contributing.html .
Thanks to Anatoly for pushing and initial work on this. Thanks to Anatoly for pushing and initial work on this.
- fix issue650: new option ``--docttest-ignore-import-errors`` which - fix issue650: new option ``--doctest-ignore-import-errors`` which
will turn import errors in doctests into skips. Thanks Charles Cloud will turn import errors in doctests into skips. Thanks Charles Cloud
for the complete PR. for the complete PR.
@ -8642,7 +8642,7 @@ time or change existing behaviors in order to make them less surprising/more use
- cleanup setup.py a bit and specify supported versions. Thanks Jurko - cleanup setup.py a bit and specify supported versions. Thanks Jurko
Gospodnetic for the PR. Gospodnetic for the PR.
- change XPASS colour to yellow rather then red when tests are run - change XPASS colour to yellow rather than red when tests are run
with -v. with -v.
- fix issue473: work around mock putting an unbound method into a class - fix issue473: work around mock putting an unbound method into a class
@ -8815,7 +8815,7 @@ time or change existing behaviors in order to make them less surprising/more use
Thanks Ralph Schmitt for the precise failure example. Thanks Ralph Schmitt for the precise failure example.
- fix issue244 by implementing special index for parameters to only use - fix issue244 by implementing special index for parameters to only use
indices for paramentrized test ids indices for parametrized test ids
- fix issue287 by running all finalizers but saving the exception - fix issue287 by running all finalizers but saving the exception
from the first failing finalizer and re-raising it so teardown will from the first failing finalizer and re-raising it so teardown will
@ -8823,7 +8823,7 @@ time or change existing behaviors in order to make them less surprising/more use
it might be the cause for other finalizers to fail. it might be the cause for other finalizers to fail.
- fix ordering when mock.patch or other standard decorator-wrappings - fix ordering when mock.patch or other standard decorator-wrappings
are used with test methods. This fixues issue346 and should are used with test methods. This fixes issue346 and should
help with random "xdist" collection failures. Thanks to help with random "xdist" collection failures. Thanks to
Ronny Pfannschmidt and Donald Stufft for helping to isolate it. Ronny Pfannschmidt and Donald Stufft for helping to isolate it.
@ -9080,7 +9080,7 @@ Bug fixes:
partially failed (finalizers would not always be called before) partially failed (finalizers would not always be called before)
- fix issue320 - fix class scope for fixtures when mixed with - fix issue320 - fix class scope for fixtures when mixed with
module-level functions. Thanks Anatloy Bubenkoff. module-level functions. Thanks Anatoly Bubenkoff.
- you can specify "-q" or "-qq" to get different levels of "quieter" - you can specify "-q" or "-qq" to get different levels of "quieter"
reporting (thanks Katarzyna Jachim) reporting (thanks Katarzyna Jachim)
@ -9502,7 +9502,7 @@ Bug fixes:
unexpected exceptions unexpected exceptions
- fix issue47: timing output in junitxml for test cases is now correct - fix issue47: timing output in junitxml for test cases is now correct
- fix issue48: typo in MarkInfo repr leading to exception - fix issue48: typo in MarkInfo repr leading to exception
- fix issue49: avoid confusing error when initizaliation partially fails - fix issue49: avoid confusing error when initialization partially fails
- fix issue44: env/username expansion for junitxml file path - fix issue44: env/username expansion for junitxml file path
- show releaselevel information in test runs for pypy - show releaselevel information in test runs for pypy
- reworked doc pages for better navigation and PDF generation - reworked doc pages for better navigation and PDF generation
@ -9627,7 +9627,7 @@ Bug fixes:
collection-before-running semantics were not collection-before-running semantics were not
setup as with pytest 1.3.4. Note, however, that setup as with pytest 1.3.4. Note, however, that
the recommended and much cleaner way to do test the recommended and much cleaner way to do test
parametraization remains the "pytest_generate_tests" parameterization remains the "pytest_generate_tests"
mechanism, see the docs. mechanism, see the docs.
2.0.0 (2010-11-25) 2.0.0 (2010-11-25)

View File

@ -462,7 +462,7 @@ Now :class:`~pytest.Class` collects the test methods directly.
Most plugins which reference ``Instance`` do so in order to ignore or skip it, Most plugins which reference ``Instance`` do so in order to ignore or skip it,
using a check such as ``if isinstance(node, Instance): return``. using a check such as ``if isinstance(node, Instance): return``.
Such plugins should simply remove consideration of ``Instance`` on pytest>=7. Such plugins should simply remove consideration of ``Instance`` on pytest>=7.
However, to keep such uses working, a dummy type has been instanted in ``pytest.Instance`` and ``_pytest.python.Instance``, However, to keep such uses working, a dummy type has been instanced in ``pytest.Instance`` and ``_pytest.python.Instance``,
and importing it emits a deprecation warning. This was removed in pytest 8. and importing it emits a deprecation warning. This was removed in pytest 8.

View File

@ -21,7 +21,7 @@ class ManifestDirectory(pytest.Directory):
@pytest.hookimpl @pytest.hookimpl
def pytest_collect_directory(path, parent): def pytest_collect_directory(path, parent):
# Use our custom collector for directories containing a `mainfest.json` file. # Use our custom collector for directories containing a `manifest.json` file.
if path.joinpath("manifest.json").is_file(): if path.joinpath("manifest.json").is_file():
return ManifestDirectory.from_parent(parent=parent, path=path) return ManifestDirectory.from_parent(parent=parent, path=path)
# Otherwise fallback to the standard behavior. # Otherwise fallback to the standard behavior.

View File

@ -274,7 +274,7 @@ Continue reading
Check out additional pytest resources to help you customize tests for your unique workflow: Check out additional pytest resources to help you customize tests for your unique workflow:
* ":ref:`usage`" for command line invocation examples * ":ref:`usage`" for command line invocation examples
* ":ref:`existingtestsuite`" for working with pre-existing tests * ":ref:`existingtestsuite`" for working with preexisting tests
* ":ref:`mark`" for information on the ``pytest.mark`` mechanism * ":ref:`mark`" for information on the ``pytest.mark`` mechanism
* ":ref:`fixtures`" for providing a functional baseline to your tests * ":ref:`fixtures`" for providing a functional baseline to your tests
* ":ref:`plugins`" for managing and writing plugins * ":ref:`plugins`" for managing and writing plugins

View File

@ -8,7 +8,7 @@ If you used older version of the ``py`` distribution (which
included the py.test command line tool and Python name space) included the py.test command line tool and Python name space)
you accessed helpers and possibly collection classes through you accessed helpers and possibly collection classes through
the ``py.test`` Python namespaces. The new ``pytest`` the ``py.test`` Python namespaces. The new ``pytest``
Python module flaty provides the same objects, following Python module flatly provides the same objects, following
these renaming rules:: these renaming rules::
py.test.XYZ -> pytest.XYZ py.test.XYZ -> pytest.XYZ

View File

@ -39,7 +39,7 @@ Built-in fixtures
Store and retrieve values across pytest runs. Store and retrieve values across pytest runs.
:fixture:`doctest_namespace` :fixture:`doctest_namespace`
Provide a dict injected into the docstests namespace. Provide a dict injected into the doctests namespace.
:fixture:`monkeypatch` :fixture:`monkeypatch`
Temporarily modify classes, functions, dictionaries, Temporarily modify classes, functions, dictionaries,

View File

@ -1940,7 +1940,7 @@ All the command-line flags can be obtained by running ``pytest --help``::
general: general:
-k EXPRESSION Only run tests which match the given substring -k EXPRESSION Only run tests which match the given substring
expression. An expression is a Python evaluatable expression. An expression is a Python evaluable
expression where all names are substring-matched expression where all names are substring-matched
against test names and their parent classes. against test names and their parent classes.
Example: -k 'test_method or test_other' matches all Example: -k 'test_method or test_other' matches all

View File

@ -41,7 +41,7 @@ _winerrnomap = {
3: errno.ENOENT, 3: errno.ENOENT,
17: errno.EEXIST, 17: errno.EEXIST,
18: errno.EXDEV, 18: errno.EXDEV,
13: errno.EBUSY, # empty cd drive, but ENOMEDIUM seems unavailiable 13: errno.EBUSY, # empty cd drive, but ENOMEDIUM seems unavailable
22: errno.ENOTDIR, 22: errno.ENOTDIR,
20: errno.ENOTDIR, 20: errno.ENOTDIR,
267: errno.ENOTDIR, 267: errno.ENOTDIR,

View File

@ -836,7 +836,7 @@ class LocalPath:
def copy(self, target, mode=False, stat=False): def copy(self, target, mode=False, stat=False):
"""Copy path to target. """Copy path to target.
If mode is True, will copy copy permission from path to target. If mode is True, will copy permission from path to target.
If stat is True, copy permission, last modification If stat is True, copy permission, last modification
time, last access time, and flags from path to target. time, last access time, and flags from path to target.
""" """
@ -1047,7 +1047,7 @@ class LocalPath:
def pypkgpath(self): def pypkgpath(self):
"""Return the Python package path by looking for the last """Return the Python package path by looking for the last
directory upwards which still contains an __init__.py. directory upwards which still contains an __init__.py.
Return None if a pkgpath can not be determined. Return None if a pkgpath cannot be determined.
""" """
pkgpath = None pkgpath = None
for parent in self.parts(reverse=True): for parent in self.parts(reverse=True):

View File

@ -584,7 +584,7 @@ def _get_assertion_exprs(src: bytes) -> Dict[int, str]:
# multi-line assert with message # multi-line assert with message
elif lineno in seen_lines: elif lineno in seen_lines:
lines[-1] = lines[-1][:offset] lines[-1] = lines[-1][:offset]
# multi line assert with escapd newline before message # multi line assert with escaped newline before message
else: else:
lines.append(line[:offset]) lines.append(line[:offset])
_write_and_reset() _write_and_reset()

View File

@ -325,7 +325,7 @@ def _diff_text(left: str, right: str, verbose: int = 0) -> List[str]:
def _compare_eq_iterable( def _compare_eq_iterable(
left: Iterable[Any], left: Iterable[Any],
right: Iterable[Any], right: Iterable[Any],
highligher: _HighlightFunc, highlighter: _HighlightFunc,
verbose: int = 0, verbose: int = 0,
) -> List[str]: ) -> List[str]:
if verbose <= 0 and not running_on_ci(): if verbose <= 0 and not running_on_ci():
@ -340,7 +340,7 @@ def _compare_eq_iterable(
# "right" is the expected base against which we compare "left", # "right" is the expected base against which we compare "left",
# see https://github.com/pytest-dev/pytest/issues/3333 # see https://github.com/pytest-dev/pytest/issues/3333
explanation.extend( explanation.extend(
highligher( highlighter(
"\n".join( "\n".join(
line.rstrip() line.rstrip()
for line in difflib.ndiff(right_formatting, left_formatting) for line in difflib.ndiff(right_formatting, left_formatting)

View File

@ -251,7 +251,7 @@ class LFPluginCollWrapper:
# Sort any lf-paths to the beginning. # Sort any lf-paths to the beginning.
lf_paths = self.lfplugin._last_failed_paths lf_paths = self.lfplugin._last_failed_paths
# Use stable sort to priorize last failed. # Use stable sort to prioritize last failed.
def sort_key(node: Union[nodes.Item, nodes.Collector]) -> bool: def sort_key(node: Union[nodes.Item, nodes.Collector]) -> bool:
return node.path in lf_paths return node.path in lf_paths

View File

@ -53,7 +53,7 @@ def iscoroutinefunction(func: object) -> bool:
def syntax, and doesn't contain yield), or a function decorated with def syntax, and doesn't contain yield), or a function decorated with
@asyncio.coroutine. @asyncio.coroutine.
Note: copied and modified from Python 3.5's builtin couroutines.py to avoid Note: copied and modified from Python 3.5's builtin coroutines.py to avoid
importing asyncio directly, which in turns also initializes the "logging" importing asyncio directly, which in turns also initializes the "logging"
module as a side-effect (see issue #8). module as a side-effect (see issue #8).
""" """

View File

@ -462,7 +462,7 @@ class PytestPluginManager(PluginManager):
# (see issue #1073). # (see issue #1073).
if not name.startswith("pytest_"): if not name.startswith("pytest_"):
return None return None
# Ignore names which can not be hooks. # Ignore names which cannot be hooks.
if name == "pytest_plugins": if name == "pytest_plugins":
return None return None
@ -574,8 +574,8 @@ class PytestPluginManager(PluginManager):
self._noconftest = noconftest self._noconftest = noconftest
self._using_pyargs = pyargs self._using_pyargs = pyargs
foundanchor = False foundanchor = False
for intitial_path in args: for initial_path in args:
path = str(intitial_path) path = str(initial_path)
# remove node-id syntax # remove node-id syntax
i = path.find("::") i = path.find("::")
if i != -1: if i != -1:

View File

@ -325,7 +325,7 @@ class FuncFixtureInfo:
working_set = set(self.initialnames) working_set = set(self.initialnames)
while working_set: while working_set:
argname = working_set.pop() argname = working_set.pop()
# Argname may be smth not included in the original names_closure, # Argname may be something not included in the original names_closure,
# in which case we ignore it. This currently happens with pseudo # in which case we ignore it. This currently happens with pseudo
# FixtureDefs which wrap 'get_direct_param_fixture_func(request)'. # FixtureDefs which wrap 'get_direct_param_fixture_func(request)'.
# So they introduce the new dependency 'request' which might have # So they introduce the new dependency 'request' which might have
@ -1701,7 +1701,7 @@ class FixtureManager:
If `node_or_object` is a collection node (with an underlying Python If `node_or_object` is a collection node (with an underlying Python
object), the node's object is traversed and the node's nodeid is used to object), the node's object is traversed and the node's nodeid is used to
determine the fixtures' visibilty. `nodeid` must not be specified in determine the fixtures' visibility. `nodeid` must not be specified in
this case. this case.
If `node_or_object` is an object (e.g. a plugin), the object is If `node_or_object` is an object (e.g. a plugin), the object is

View File

@ -650,7 +650,7 @@ def pytest_runtest_protocol(
- ``pytest_runtest_logreport(report)`` - ``pytest_runtest_logreport(report)``
- ``pytest_exception_interact(call, report)`` if an interactive exception occurred - ``pytest_exception_interact(call, report)`` if an interactive exception occurred
- Call phase, if the the setup passed and the ``setuponly`` pytest option is not set: - Call phase, if the setup passed and the ``setuponly`` pytest option is not set:
- ``call = pytest_runtest_call(item)`` (wrapped in ``CallInfo(when="call")``) - ``call = pytest_runtest_call(item)`` (wrapped in ``CallInfo(when="call")``)
- ``report = pytest_runtest_makereport(item, call)`` - ``report = pytest_runtest_makereport(item, call)``
- ``pytest_runtest_logreport(report)`` - ``pytest_runtest_logreport(report)``
@ -860,7 +860,7 @@ def pytest_fixture_setup(
) -> Optional[object]: ) -> Optional[object]:
"""Perform fixture setup execution. """Perform fixture setup execution.
:param fixturdef: :param fixturedef:
The fixture definition object. The fixture definition object.
:param request: :param request:
The fixture request object. The fixture request object.
@ -890,7 +890,7 @@ def pytest_fixture_post_finalizer(
the fixture result ``fixturedef.cached_result`` is still available (not the fixture result ``fixturedef.cached_result`` is still available (not
``None``). ``None``).
:param fixturdef: :param fixturedef:
The fixture definition object. The fixture definition object.
:param request: :param request:
The fixture request object. The fixture request object.

View File

@ -384,7 +384,7 @@ def Config_inifile(self: Config) -> Optional[LEGACY_PATH]:
return legacy_path(str(self.inipath)) if self.inipath else None return legacy_path(str(self.inipath)) if self.inipath else None
def Session_stardir(self: Session) -> LEGACY_PATH: def Session_startdir(self: Session) -> LEGACY_PATH:
"""The path from which pytest was invoked. """The path from which pytest was invoked.
Prefer to use ``startpath`` which is a :class:`pathlib.Path`. Prefer to use ``startpath`` which is a :class:`pathlib.Path`.
@ -439,7 +439,7 @@ def pytest_load_initial_conftests(early_config: Config) -> None:
mp.setattr(Config, "inifile", property(Config_inifile), raising=False) mp.setattr(Config, "inifile", property(Config_inifile), raising=False)
# Add Session.startdir property. # Add Session.startdir property.
mp.setattr(Session, "startdir", property(Session_stardir), raising=False) mp.setattr(Session, "startdir", property(Session_startdir), raising=False)
# Add pathlist configuration type. # Add pathlist configuration type.
mp.setattr(Config, "_getini_unknown_type", Config__getini_unknown_type) mp.setattr(Config, "_getini_unknown_type", Config__getini_unknown_type)

View File

@ -78,7 +78,7 @@ def pytest_addoption(parser: Parser) -> None:
default="", default="",
metavar="EXPRESSION", metavar="EXPRESSION",
help="Only run tests which match the given substring expression. " help="Only run tests which match the given substring expression. "
"An expression is a Python evaluatable expression " "An expression is a Python evaluable expression "
"where all names are substring-matched against test names " "where all names are substring-matched against test names "
"and their parent classes. Example: -k 'test_method or test_" "and their parent classes. Example: -k 'test_method or test_"
"other' matches all test functions and classes whose name " "other' matches all test functions and classes whose name "

View File

@ -173,7 +173,7 @@ def rm_rf(path: Path) -> None:
def find_prefixed(root: Path, prefix: str) -> Iterator["os.DirEntry[str]"]: def find_prefixed(root: Path, prefix: str) -> Iterator["os.DirEntry[str]"]:
"""Find all elements in root that begin with the prefix, case insensitive.""" """Find all elements in root that begin with the prefix, case-insensitive."""
l_prefix = prefix.lower() l_prefix = prefix.lower()
for x in os.scandir(root): for x in os.scandir(root):
if x.name.lower().startswith(l_prefix): if x.name.lower().startswith(l_prefix):
@ -776,7 +776,7 @@ def resolve_package_path(path: Path) -> Optional[Path]:
"""Return the Python package path by looking for the last """Return the Python package path by looking for the last
directory upwards which still contains an __init__.py. directory upwards which still contains an __init__.py.
Returns None if it can not be determined. Returns None if it cannot be determined.
""" """
result = None result = None
for parent in itertools.chain((path,), path.parents): for parent in itertools.chain((path,), path.parents):

View File

@ -40,7 +40,7 @@ def pytest_addoption(parser: Parser) -> None:
@pytest.hookimpl @pytest.hookimpl
def pytest_configure(config: Config) -> None: def pytest_configure(config: Config) -> None:
if config.option.stepwise_skip: if config.option.stepwise_skip:
# allow --stepwise-skip to work on it's own merits. # allow --stepwise-skip to work on its own merits.
config.option.stepwise = True config.option.stepwise = True
if config.getoption("stepwise"): if config.getoption("stepwise"):
config.pluginmanager.register(StepwisePlugin(config), "stepwiseplugin") config.pluginmanager.register(StepwisePlugin(config), "stepwiseplugin")

View File

@ -667,7 +667,7 @@ class TestLocalPath(CommonFSTests):
assert p == os.path.expanduser("~") assert p == os.path.expanduser("~")
@pytest.mark.skipif( @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): def test_eq_hash_are_case_insensitive_on_windows(self):
a = local("/some/path") a = local("/some/path")
@ -898,7 +898,7 @@ class TestExecutionOnWindows:
class TestExecution: class TestExecution:
pytestmark = skiponwin32 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) noperm = tmpdir.ensure("noperm", dir=True)
monkeypatch.setenv("PATH", str(noperm), prepend=":") monkeypatch.setenv("PATH", str(noperm), prepend=":")
noperm.chmod(0) noperm.chmod(0)

View File

@ -1515,7 +1515,7 @@ def test_cwd_deleted(pytester: Pytester) -> None:
result.stderr.no_fnmatch_line("*INTERNALERROR*") 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 With Python 3.10 alphas, there was an INTERNALERROR reported in
https://github.com/pytest-dev/pytest/pull/8227 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" 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(): def f():
c = """while True: c = """while True:
pass pass

View File

@ -117,7 +117,7 @@ def test_change_disabled_level_undo(pytester: Pytester) -> None:
result.stdout.no_fnmatch_line("*log from test2*") 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). """Ensure that 'set_level' is undone after the end of the test (handler).
Issue #7569. Tests the handler level specifically. 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"] 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 caplog: pytest.LogCaptureFixture, logging_during_setup_and_teardown: None
) -> None: ) -> None:
assert not caplog.records 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"] 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! private_assert_caplog_records_is_setup_call(caplog)
caplog_records = caplog._item.stash[caplog_records_key]
assert set(caplog_records) == {"setup", "call"}
def test_clear_for_call_stage( def test_clear_for_call_stage(
@ -323,21 +329,18 @@ def test_clear_for_call_stage(
logger.info("a_call_log") 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("call")] == ["a_call_log"]
assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"] assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"]
caplog_records = caplog._item.stash[caplog_records_key] private_assert_caplog_records_is_setup_call(caplog)
assert set(caplog_records) == {"setup", "call"}
caplog.clear() caplog.clear()
assert caplog.get_records("call") == [] assert caplog.get_records("call") == []
assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"] assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"]
caplog_records = caplog._item.stash[caplog_records_key] private_assert_caplog_records_is_setup_call(caplog)
assert set(caplog_records) == {"setup", "call"}
logging.info("a_call_log_after_clear") 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("call")] == ["a_call_log_after_clear"]
assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"] assert [x.message for x in caplog.get_records("setup")] == ["a_setup_log"]
caplog_records = caplog._item.stash[caplog_records_key] private_assert_caplog_records_is_setup_call(caplog)
assert set(caplog_records) == {"setup", "call"}
def test_ini_controls_global_log_level(pytester: Pytester) -> None: 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() 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 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( pytester.makepyfile(
""" """
import pytest import pytest
@ -406,7 +409,7 @@ def test_caplog_can_override_global_log_level(pytester: Pytester) -> None:
assert result.ret == 0 assert result.ret == 0
def test_caplog_captures_despite_exception(pytester: Pytester) -> None: def test_captures_despite_exception(pytester: Pytester) -> None:
pytester.makepyfile( pytester.makepyfile(
""" """
import pytest import pytest

View File

@ -933,7 +933,7 @@ class TestRequestBasic:
) -> None: ) -> None:
""" """
Ensure exceptions raised during teardown by finalizers are suppressed 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) exception group (#2440)
""" """
pytester.makepyfile( pytester.makepyfile(

View File

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

View File

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

View File

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

View File

@ -70,7 +70,7 @@ class TestConftestValueAccessGlobal:
) )
assert conftest._rget_with_confmod("a", p)[1] == 1 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 self, basedir: Path
) -> None: ) -> None:
conftest = PytestPluginManager() conftest = PytestPluginManager()
@ -396,7 +396,7 @@ def test_conftest_symlink_files(pytester: Pytester) -> None:
@pytest.mark.skipif( @pytest.mark.skipif(
os.path.normcase("x") != os.path.normcase("X"), 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: def test_conftest_badcase(pytester: Pytester) -> None:
"""Check conftest.py loading when directory casing is wrong (#5792).""" """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: 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( p1 = pytester.makepyfile(
""" """
from _pytest.debugging import pytestPDB 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: 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( p1 = pytester.makepyfile(
""" """
def call_pdb_set_trace(): 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( pytester.makepyfile(
""" """
class Sample(object): class Sample(object):
@ -414,7 +414,7 @@ class TestDoctests:
result.stdout.fnmatch_lines( result.stdout.fnmatch_lines(
[ [
"*= FAILURES =*", "*= 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", "EXAMPLE LOCATION UNKNOWN, not showing all tests of that example",
"[?][?][?] >>> Sample().some_property", "[?][?][?] >>> Sample().some_property",
"Expected:", "Expected:",
@ -422,7 +422,7 @@ class TestDoctests:
"Got:", "Got:",
" 'something'", " 'something'",
"", "",
"*/test_doctest_no_linedata_on_overriden_property.py:None: DocTestFailure", "*/test_doctest_no_linedata_on_overridden_property.py:None: DocTestFailure",
"*= 1 failed in *", "*= 1 failed in *",
] ]
) )

View File

@ -1002,7 +1002,7 @@ class TestNonPython:
@pytest.mark.parametrize("junit_logging", ["no", "system-out"]) @pytest.mark.parametrize("junit_logging", ["no", "system-out"])
def test_nullbyte(pytester: Pytester, junit_logging: str) -> None: 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( pytester.makepyfile(
""" """
import sys import sys

View File

@ -155,7 +155,7 @@ def test_override_ini_paths(pytester: pytest.Pytester) -> None:
) )
pytester.makepyfile( pytester.makepyfile(
r""" r"""
def test_overriden(pytestconfig): def test_overridden(pytestconfig):
config_paths = pytestconfig.getini("paths") config_paths = pytestconfig.getini("paths")
print(config_paths) print(config_paths)
for cpf in 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), ("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__ matcher = {"true": True, "false": False}.__getitem__
assert evaluate(expr, matcher) is expected assert evaluate(expr, matcher) is expected

View File

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

View File

@ -409,7 +409,7 @@ class BaseFunctionalTests:
# assert rep.outcome.when == "setup" # assert rep.outcome.when == "setup"
# assert rep.outcome.where.lineno == 3 # assert rep.outcome.where.lineno == 3
# assert rep.outcome.where.path.basename == "test_func.py" # 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: def test_systemexit_does_not_bail_out(self, pytester: Pytester) -> None:
try: try:

View File

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

View File

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