Compare commits

..

1 Commits

Author SHA1 Message Date
pre-commit-ci[bot] 3a1e17355b
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.10 → v0.5.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.10...v0.5.0)
- [github.com/adamchainz/blacken-docs: 1.16.0 → 1.18.0](https://github.com/adamchainz/blacken-docs/compare/1.16.0...1.18.0)
- [github.com/pre-commit/mirrors-mypy: v1.10.0 → v1.10.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.0...v1.10.1)
2024-07-02 00:16:55 +00:00
12 changed files with 13 additions and 59 deletions

View File

@ -1,6 +1,6 @@
repos: repos:
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.10" rev: "v0.5.0"
hooks: hooks:
- id: ruff - id: ruff
args: ["--fix"] args: ["--fix"]
@ -12,7 +12,7 @@ repos:
- id: end-of-file-fixer - id: end-of-file-fixer
- id: check-yaml - id: check-yaml
- repo: https://github.com/adamchainz/blacken-docs - repo: https://github.com/adamchainz/blacken-docs
rev: 1.16.0 rev: 1.18.0
hooks: hooks:
- id: blacken-docs - id: blacken-docs
additional_dependencies: [black==24.1.1] additional_dependencies: [black==24.1.1]
@ -21,7 +21,7 @@ repos:
hooks: hooks:
- id: python-use-type-annotations - id: python-use-type-annotations
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0 rev: v1.10.1
hooks: hooks:
- id: mypy - id: mypy
files: ^(src/|testing/|scripts/) files: ^(src/|testing/|scripts/)
@ -102,14 +102,6 @@ repos:
) )
$ $
files: ^changelog/ files: ^changelog/
- id: changelogs-user-role
name: Changelog files should use a non-broken :user:`name` role
language: pygrep
entry: :user:([^`]+`?|`[^`]+[\s,])
pass_filenames: true
types:
- file
- rst
- id: py-deprecated - id: py-deprecated
name: py library is deprecated name: py library is deprecated
language: pygrep language: pygrep

View File

@ -430,7 +430,6 @@ Victor Rodriguez
Victor Uriarte Victor Uriarte
Vidar T. Fauske Vidar T. Fauske
Vijay Arora Vijay Arora
Virendra Patil
Virgil Dupras Virgil Dupras
Vitaly Lashmanov Vitaly Lashmanov
Vivaan Verma Vivaan Verma

View File

@ -1,11 +1,7 @@
Fixed a regression in pytest 8.0 where tracebacks get longer and longer when multiple Fix a regression in pytest 8.0 where tracebacks get longer and longer when multiple tests fail due to a shared higher-scope fixture which raised.
tests fail due to a shared higher-scope fixture which raised -- by :user:`bluetech`.
Also fixed a similar regression in pytest 5.4 for collectors which raise during setup. Also fix a similar regression in pytest 5.4 for collectors which raise during setup.
The fix necessitated internal changes which may affect some plugins: The fix necessitated internal changes which may affect some plugins:
- ``FixtureDef.cached_result[2]`` is now a tuple ``(exc, tb)`` instead of ``exc``.
* ``FixtureDef.cached_result[2]`` is now a tuple ``(exc, tb)`` - ``SetupState.stack`` failures are now a tuple ``(exc, tb)`` instead of ``exc``.
instead of ``exc``.
* ``SetupState.stack`` failures are now a tuple ``(exc, tb)``
instead of ``exc``.

View File

@ -1 +0,0 @@
12204.bugfix.rst

View File

@ -4,4 +4,4 @@ the automatically created pull requests and re-open them to trigger the
CI runs. From now on, they only need to click the `Ready for review` CI runs. From now on, they only need to click the `Ready for review`
button instead. button instead.
-- by :user:`webknjaz` -- by :user:`webknjaz`.

View File

@ -1 +0,0 @@
Improve handling of invalid regex patterns in :func:`pytest.raises(match=r'...') <pytest.raises>` by providing a clear error message.

View File

@ -3,4 +3,4 @@ pytest's own tests marked as expected to fail from the coverage
report. This has an effect of reducing the influence of flaky report. This has an effect of reducing the influence of flaky
tests on the resulting number. tests on the resulting number.
-- by :user:`webknjaz` -- by :user`webknjaz`

View File

@ -1,3 +1,4 @@
The ``_in_venv()`` function now detects Python virtual environments by The _in_venv function now detects Python virtual environments by checking
checking for a :file:`pyvenv.cfg` file, ensuring reliable detection on for a pyvenv.cfg file, ensuring reliable detection on various platforms.
various platforms -- by :user:`zachsnickers`.
-- by :user:`zachsnickers`.

View File

@ -1 +0,0 @@
12544.improvement.rst

View File

@ -1,2 +0,0 @@
Possible typos in using the ``:user:`` RST role is now being linted
through the pre-commit tool integration -- by :user:`webknjaz`.

View File

@ -7,7 +7,6 @@ from decimal import Decimal
import math import math
from numbers import Complex from numbers import Complex
import pprint import pprint
import re
from types import TracebackType from types import TracebackType
from typing import Any from typing import Any
from typing import Callable from typing import Callable
@ -987,14 +986,6 @@ class RaisesContext(ContextManager[_pytest._code.ExceptionInfo[E]]):
self.message = message self.message = message
self.match_expr = match_expr self.match_expr = match_expr
self.excinfo: _pytest._code.ExceptionInfo[E] | None = None self.excinfo: _pytest._code.ExceptionInfo[E] | None = None
if self.match_expr is not None:
re_error = None
try:
re.compile(self.match_expr)
except re.error as e:
re_error = e
if re_error is not None:
fail(f"Invalid regex pattern provided to 'match': {re_error}")
def __enter__(self) -> _pytest._code.ExceptionInfo[E]: def __enter__(self) -> _pytest._code.ExceptionInfo[E]:
self.excinfo = _pytest._code.ExceptionInfo.for_later() self.excinfo = _pytest._code.ExceptionInfo.for_later()

View File

@ -132,26 +132,6 @@ class TestRaises:
result = pytester.runpytest() result = pytester.runpytest()
result.stdout.fnmatch_lines(["*2 failed*"]) result.stdout.fnmatch_lines(["*2 failed*"])
def test_raises_with_invalid_regex(self, pytester: Pytester) -> None:
pytester.makepyfile(
"""
import pytest
def test_invalid_regex():
with pytest.raises(ValueError, match="invalid regex character ["):
raise ValueError()
"""
)
result = pytester.runpytest()
result.stdout.fnmatch_lines(
[
"*Invalid regex pattern provided to 'match': unterminated character set at position 24*",
]
)
result.stdout.no_fnmatch_line("*Traceback*")
result.stdout.no_fnmatch_line("*File*")
result.stdout.no_fnmatch_line("*line*")
def test_noclass(self) -> None: def test_noclass(self) -> None:
with pytest.raises(TypeError): with pytest.raises(TypeError):
pytest.raises("wrong", lambda: None) # type: ignore[call-overload] pytest.raises("wrong", lambda: None) # type: ignore[call-overload]