Fix typos and introduce codespell pre-commit hook (#12769)
This commit is contained in:
parent
c6a0ef175a
commit
09e386e3e0
|
@ -16,6 +16,13 @@ repos:
|
|||
hooks:
|
||||
- id: blacken-docs
|
||||
additional_dependencies: [black==24.1.1]
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.3.0
|
||||
hooks:
|
||||
- id: codespell
|
||||
args: ["--toml=pyproject.toml"]
|
||||
additional_dependencies:
|
||||
- tomli
|
||||
- repo: https://github.com/pre-commit/pygrep-hooks
|
||||
rev: v1.10.0
|
||||
hooks:
|
||||
|
|
1
AUTHORS
1
AUTHORS
|
@ -85,6 +85,7 @@ Chris NeJame
|
|||
Chris Rose
|
||||
Chris Wheeler
|
||||
Christian Boelsen
|
||||
Christian Clauss
|
||||
Christian Fetzer
|
||||
Christian Neumüller
|
||||
Christian Theunert
|
||||
|
|
|
@ -543,4 +543,4 @@ Closing issues
|
|||
|
||||
When a pull request is submitted to fix an issue, add text like ``closes #XYZW`` to the PR description and/or commits (where ``XYZW`` is the issue number). See the `GitHub docs <https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword>`_ for more information.
|
||||
|
||||
When an issue is due to user error (e.g. misunderstanding of a functionality), please politely explain to the user why the issue raised is really a non-issue and ask them to close the issue if they have no further questions. If the original requestor is unresponsive, the issue will be handled as described in the section `Handling stale issues/PRs`_ above.
|
||||
When an issue is due to user error (e.g. misunderstanding of a functionality), please politely explain to the user why the issue raised is really a non-issue and ask them to close the issue if they have no further questions. If the original requester is unresponsive, the issue will be handled as described in the section `Handling stale issues/PRs`_ above.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Fix typos discovered by codespell and add codespell to pre-commit hooks.
|
|
@ -6,10 +6,10 @@ and parametrized testing in Python. It is now easier, more efficient and
|
|||
more predictable to re-run the same tests with different fixture
|
||||
instances. Also, you can directly declare the caching "scope" of
|
||||
fixtures so that dependent tests throughout your whole test suite can
|
||||
re-use database or other expensive fixture objects with ease. Lastly,
|
||||
reuse database or other expensive fixture objects with ease. Lastly,
|
||||
it's possible for fixture functions (formerly known as funcarg
|
||||
factories) to use other fixtures, allowing for a completely modular and
|
||||
re-usable fixture design.
|
||||
reusable fixture design.
|
||||
|
||||
For detailed info and tutorial-style examples, see:
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ Improved documentation
|
|||
-- by :user:`webknjaz`
|
||||
|
||||
|
||||
- `#12577 <https://github.com/pytest-dev/pytest/issues/12577>`_: `CI` and `BUILD_NUMBER` environment variables role is discribed in
|
||||
- `#12577 <https://github.com/pytest-dev/pytest/issues/12577>`_: `CI` and `BUILD_NUMBER` environment variables role is described in
|
||||
the reference doc. They now also appear when doing `pytest -h`
|
||||
-- by :user:`MarcBresson`.
|
||||
|
||||
|
@ -319,7 +319,7 @@ Bug Fixes
|
|||
- `#12367 <https://github.com/pytest-dev/pytest/issues/12367>`_: Fix a regression in pytest 8.2.0 where unittest class instances (a fresh one is created for each test) were not released promptly on test teardown but only on session teardown.
|
||||
|
||||
|
||||
- `#12381 <https://github.com/pytest-dev/pytest/issues/12381>`_: Fix possible "Directory not empty" crashes arising from concurent cache dir (``.pytest_cache``) creation. Regressed in pytest 8.2.0.
|
||||
- `#12381 <https://github.com/pytest-dev/pytest/issues/12381>`_: Fix possible "Directory not empty" crashes arising from concurrent cache dir (``.pytest_cache``) creation. Regressed in pytest 8.2.0.
|
||||
|
||||
|
||||
|
||||
|
@ -330,7 +330,7 @@ Improved Documentation
|
|||
|
||||
|
||||
- `#12356 <https://github.com/pytest-dev/pytest/issues/12356>`_: Added a subsection to the documentation for debugging flaky tests to mention
|
||||
lack of thread safety in pytest as a possible source of flakyness.
|
||||
lack of thread safety in pytest as a possible source of flakiness.
|
||||
|
||||
|
||||
- `#12363 <https://github.com/pytest-dev/pytest/issues/12363>`_: The documentation webpages now links to a canonical version to reduce outdated documentation in search engine results.
|
||||
|
@ -676,7 +676,7 @@ Bug Fixes
|
|||
This bug was introduced in pytest 8.0.0rc1.
|
||||
|
||||
|
||||
- `#9765 <https://github.com/pytest-dev/pytest/issues/9765>`_, `#11816 <https://github.com/pytest-dev/pytest/issues/11816>`_: Fixed a frustrating bug that afflicted some users with the only error being ``assert mod not in mods``. The issue was caused by the fact that ``str(Path(mod))`` and ``mod.__file__`` don't necessarily produce the same string, and was being erroneously used interchangably in some places in the code.
|
||||
- `#9765 <https://github.com/pytest-dev/pytest/issues/9765>`_, `#11816 <https://github.com/pytest-dev/pytest/issues/11816>`_: Fixed a frustrating bug that afflicted some users with the only error being ``assert mod not in mods``. The issue was caused by the fact that ``str(Path(mod))`` and ``mod.__file__`` don't necessarily produce the same string, and was being erroneously used interchangeably in some places in the code.
|
||||
|
||||
This fix also broke the internal API of ``PytestPluginManager.consider_conftest`` by introducing a new parameter -- we mention this in case it is being used by external code, even if marked as *private*.
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ If the import attempt raises :class:`ModuleNotFoundError` (the usual case), then
|
|||
warning is emitted.
|
||||
|
||||
This way, the usual cases will keep working the same way, while unexpected errors will now issue a warning, with
|
||||
users being able to supress the warning by passing ``exc_type=ImportError`` explicitly.
|
||||
users being able to suppress the warning by passing ``exc_type=ImportError`` explicitly.
|
||||
|
||||
In ``9.0``, the warning will turn into an error, and in ``9.1`` :func:`pytest.importorskip` will only capture
|
||||
:class:`ModuleNotFoundError` by default and no warnings will be issued anymore -- but users can still capture
|
||||
|
|
|
@ -75,7 +75,7 @@ style of setup/teardown functions:
|
|||
|
||||
* fixture management scales from simple unit to complex
|
||||
functional testing, allowing to parametrize fixtures and tests according
|
||||
to configuration and component options, or to re-use fixtures
|
||||
to configuration and component options, or to reuse fixtures
|
||||
across function, class, module or whole test session scopes.
|
||||
|
||||
* teardown logic can be easily, and safely managed, no matter how many fixtures
|
||||
|
|
|
@ -16,7 +16,7 @@ Shortcomings of the previous ``pytest_funcarg__`` mechanism
|
|||
|
||||
The pre pytest-2.3 funcarg mechanism calls a factory each time a
|
||||
funcarg for a test function is required. If a factory wants to
|
||||
re-use a resource across different scopes, it often used
|
||||
reuse a resource across different scopes, it often used
|
||||
the ``request.cached_setup()`` helper to manage caching of
|
||||
resources. Here is a basic example how we could implement
|
||||
a per-session Database object:
|
||||
|
@ -107,7 +107,7 @@ the tests requiring "db" will run twice as well. The "mysql" and
|
|||
"pg" values will also be used for reporting the test-invocation variants.
|
||||
|
||||
This new way of parametrizing funcarg factories should in many cases
|
||||
allow to re-use already written factories because effectively
|
||||
allow to reuse already written factories because effectively
|
||||
``request.param`` was already used when test functions/classes were
|
||||
parametrized via
|
||||
:py:func:`metafunc.parametrize(indirect=True) <pytest.Metafunc.parametrize>` calls.
|
||||
|
@ -164,7 +164,7 @@ hook which are often used to setup global resources. This suffers from
|
|||
several problems:
|
||||
|
||||
1. in distributed testing the managing process would setup test resources
|
||||
that are never needed because it only co-ordinates the test run
|
||||
that are never needed because it only coordinates the test run
|
||||
activities of the worker processes.
|
||||
|
||||
2. if you only perform a collection (with "--collect-only")
|
||||
|
|
|
@ -1487,7 +1487,7 @@ Modularity: using fixtures from a fixture function
|
|||
|
||||
In addition to using fixtures in test functions, fixture functions
|
||||
can use other fixtures themselves. This contributes to a modular design
|
||||
of your fixtures and allows re-use of framework-specific fixtures across
|
||||
of your fixtures and allows reuse of framework-specific fixtures across
|
||||
many projects. As a simple example, we can extend the previous example
|
||||
and instantiate an object ``app`` where we stick the already defined
|
||||
``smtp_connection`` resource into it:
|
||||
|
|
|
@ -109,7 +109,7 @@ achieves this by receiving a special ``request`` object which gives
|
|||
access to :ref:`the requesting test context <request-context>` such
|
||||
as the ``cls`` attribute, denoting the class from which the fixture
|
||||
is used. This architecture de-couples fixture writing from actual test
|
||||
code and allows re-use of the fixture by a minimal reference, the fixture
|
||||
code and allows reuse of the fixture by a minimal reference, the fixture
|
||||
name. So let's write an actual ``unittest.TestCase`` class using our
|
||||
fixture definition:
|
||||
|
||||
|
|
|
@ -307,6 +307,11 @@ disable = [
|
|||
"wrong-import-position", # handled by isort / ruff
|
||||
]
|
||||
|
||||
[tool.codespell]
|
||||
ignore-words-list = "afile,asser,assertio,feld,hove,ned,noes,notin,paramete,parth,socio-economic,tesults,varius,wil"
|
||||
skip = "*/plugin_list.rst"
|
||||
write-changes = true
|
||||
|
||||
[tool.check-wheel-contents]
|
||||
# check-wheel-contents is executed by the build-and-inspect-python-package action.
|
||||
# W009: Wheel contains multiple toplevel library entries
|
||||
|
|
|
@ -360,7 +360,7 @@ def _get_legacy_hook_marks(
|
|||
opt_names: tuple[str, ...],
|
||||
) -> dict[str, bool]:
|
||||
if TYPE_CHECKING:
|
||||
# abuse typeguard from importlib to avoid massive method type union thats lacking a alias
|
||||
# abuse typeguard from importlib to avoid massive method type union that's lacking an alias
|
||||
assert inspect.isroutine(method)
|
||||
known_marks: set[str] = {m.name for m in getattr(method, "pytestmark", [])}
|
||||
must_warn: list[str] = []
|
||||
|
|
|
@ -332,7 +332,7 @@ def maybe_wrap_pytest_function_for_tracing(pyfuncitem) -> None:
|
|||
def _enter_pdb(
|
||||
node: Node, excinfo: ExceptionInfo[BaseException], rep: BaseReport
|
||||
) -> BaseReport:
|
||||
# XXX we re-use the TerminalReporter's terminalwriter
|
||||
# XXX we reuse the TerminalReporter's terminalwriter
|
||||
# because this seems to avoid some encoding related troubles
|
||||
# for not completely clear reasons.
|
||||
tw = node.config.pluginmanager.getplugin("terminalreporter")._tw
|
||||
|
|
|
@ -4338,7 +4338,7 @@ class TestScopeOrdering:
|
|||
assert request.fixturenames == "s1 p1 m1 m2 c1 f2 f1".split()
|
||||
|
||||
def test_parametrized_package_scope_reordering(self, pytester: Pytester) -> None:
|
||||
"""A paramaterized package-scoped fixture correctly reorders items to
|
||||
"""A parameterized package-scoped fixture correctly reorders items to
|
||||
minimize setups & teardowns.
|
||||
|
||||
Regression test for #12328.
|
||||
|
|
|
@ -917,7 +917,7 @@ class TestConfigAPI:
|
|||
# default for string is ""
|
||||
value = config.getini("string1")
|
||||
assert value == ""
|
||||
# should return None if None is explicity set as default value
|
||||
# should return None if None is explicitly set as default value
|
||||
# irrespective of the type argument
|
||||
value = config.getini("none_1")
|
||||
assert value is None
|
||||
|
|
Loading…
Reference in New Issue