Merge branch 'fix-invalid-regex-handling' of https://github.com/virendrapatil24/pytest into fix-invalid-regex-handling
This commit is contained in:
commit
2e1b09d9ca
|
@ -47,7 +47,7 @@ jobs:
|
|||
|
||||
- name: Create Pull Request
|
||||
id: pr
|
||||
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e
|
||||
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c
|
||||
with:
|
||||
commit-message: '[automated] Update plugin list'
|
||||
author: 'pytest bot <pytestbot@users.noreply.github.com>'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: "v0.4.9"
|
||||
rev: "v0.4.10"
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: ["--fix"]
|
||||
|
|
|
@ -1 +1 @@
|
|||
Improve handling of invalid regex patterns in :func:`pytest.raises(match=r'...') <pytest.raises>` by providing a clear error message.
|
||||
Improve handling of invalid regex patterns in :func:`pytest.raises(match=r'...') <pytest.raises>` by providing a clear error message.
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
The ``extlinks`` Sphinx extension is no longer enabled. The ``:bpo:``
|
||||
role it used to declare has been removed with that. BPO itself has
|
||||
migrated to GitHub some years ago and it is possible to link the
|
||||
respective issues by using their GitHub issue numbers and the
|
||||
``:issue:`` role that the ``sphinx-issues`` extension implements.
|
||||
|
||||
-- by :user:`webknjaz`
|
|
@ -3360,7 +3360,9 @@ Bug Fixes
|
|||
- :issue:`5914`: pytester: fix :py:func:`~pytest.LineMatcher.no_fnmatch_line` when used after positive matching.
|
||||
|
||||
|
||||
- :issue:`6082`: Fix line detection for doctest samples inside :py:class:`python:property` docstrings, as a workaround to :bpo:`17446`.
|
||||
- :issue:`6082`: Fix line detection for doctest samples inside
|
||||
:py:class:`python:property` docstrings, as a workaround to
|
||||
:issue:`python/cpython#61648`.
|
||||
|
||||
|
||||
- :issue:`6254`: Fix compatibility with pytest-parallel (regression in pytest 5.3.0).
|
||||
|
|
|
@ -82,7 +82,6 @@ extensions = [
|
|||
"pygments_pytest",
|
||||
"sphinx.ext.autodoc",
|
||||
"sphinx.ext.autosummary",
|
||||
"sphinx.ext.extlinks",
|
||||
"sphinx.ext.intersphinx",
|
||||
"sphinx.ext.todo",
|
||||
"sphinx.ext.viewcode",
|
||||
|
@ -171,11 +170,6 @@ linkcheck_ignore = [
|
|||
linkcheck_workers = 5
|
||||
|
||||
|
||||
extlinks = {
|
||||
"bpo": ("https://bugs.python.org/issue%s", "bpo-%s"),
|
||||
}
|
||||
|
||||
|
||||
nitpicky = True
|
||||
nitpick_ignore = [
|
||||
# TODO (fix in pluggy?)
|
||||
|
|
|
@ -80,7 +80,7 @@ keyword arguments, e.g. to run only tests marked with ``device`` and the specifi
|
|||
|
||||
.. code-block:: pytest
|
||||
|
||||
$ pytest -v -m 'device(serial="123")'
|
||||
$ pytest -v -m "device(serial='123')"
|
||||
=========================== test session starts ============================
|
||||
platform linux -- Python 3.x.y, pytest-8.x.y, pluggy-1.x.y -- $PYTHON_PREFIX/bin/python
|
||||
cachedir: .pytest_cache
|
||||
|
|
|
@ -88,7 +88,7 @@ with the ``phase`` keyword argument set to ``1``:
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
pytest -m slow(phase=1)
|
||||
pytest -m "slow(phase=1)"
|
||||
|
||||
For more information see :ref:`marks <mark>`.
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
|
||||
.. sidebar:: **Next Open Trainings and Events**
|
||||
|
||||
- `pytest development sprint <https://github.com/pytest-dev/sprint>`_, **June 17th -- 22nd 2024**, Klaus (AT) / Remote
|
||||
- `pytest tips and tricks for a better testsuite <https://ep2024.europython.eu/session/pytest-tips-and-tricks-for-a-better-testsuite>`_, at `Europython 2024 <https://ep2024.europython.eu/>`_, **July 8th -- 14th 2024** (3h), Prague (CZ)
|
||||
- `pytest tips and tricks for a better testsuite <https://ep2024.europython.eu/session/pytest-tips-and-tricks-for-a-better-testsuite>`_, at `Europython 2024 <https://ep2024.europython.eu/>`_, **July 9th 2024** (3h), Prague (CZ)
|
||||
- `pytest: Professionelles Testen (nicht nur) für Python <https://pretalx.com/workshoptage-2024/talk/9VUHYB/>`_, at `CH Open Workshoptage <https://workshoptage.ch/>`_, **September 2nd 2024**, HSLU Rotkreuz (CH)
|
||||
- `Professional Testing with Python <https://python-academy.com/courses/python_course_testing.html>`_, via `Python Academy <https://www.python-academy.com/>`_ (3 day in-depth training), **March 4th -- 6th 2025**, Leipzig (DE) / Remote
|
||||
|
||||
|
|
|
@ -5,15 +5,19 @@ The grammar is:
|
|||
expression: expr? EOF
|
||||
expr: and_expr ('or' and_expr)*
|
||||
and_expr: not_expr ('and' not_expr)*
|
||||
not_expr: 'not' not_expr | '(' expr ')' | ident ( '(' name '=' value ( ', ' name '=' value )* ')')*
|
||||
not_expr: 'not' not_expr | '(' expr ')' | ident kwargs?
|
||||
|
||||
ident: (\w|:|\+|-|\.|\[|\]|\\|/)+
|
||||
kwargs: ('(' name '=' value ( ', ' name '=' value )* ')')
|
||||
name: a valid ident, but not a reserved keyword
|
||||
value: (unescaped) string literal | (-)?[0-9]+ | 'False' | 'True' | 'None'
|
||||
|
||||
The semantics are:
|
||||
|
||||
- Empty expression evaluates to False.
|
||||
- ident evaluates to True of False according to a provided matcher function.
|
||||
- ident evaluates to True or False according to a provided matcher function.
|
||||
- or/and/not evaluate according to the usual boolean semantics.
|
||||
- ident with parentheses and keyword arguments evaluates to True or False according to a provided matcher function.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
@ -48,7 +52,7 @@ class TokenType(enum.Enum):
|
|||
IDENT = "identifier"
|
||||
EOF = "end of input"
|
||||
EQUAL = "="
|
||||
STRING = "str"
|
||||
STRING = "string literal"
|
||||
COMMA = ","
|
||||
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ def test_mark_option(
|
|||
|
||||
@pytest.mark.parametrize(
|
||||
("expr", "expected_passed"),
|
||||
[ # TODO: improve/sort out
|
||||
[
|
||||
("car(color='red')", ["test_one"]),
|
||||
("car(color='red') or car(color='blue')", ["test_one", "test_two"]),
|
||||
("car and not car(temp=5)", ["test_one", "test_three"]),
|
||||
|
|
|
@ -228,9 +228,10 @@ def test_invalid_idents(ident: str) -> None:
|
|||
r'escaping with "\\" not supported in marker expression',
|
||||
),
|
||||
("mark(empty_list=[])", r'unexpected character/s "\[\]"'),
|
||||
("'str'", "expected not OR left parenthesis OR identifier; got string literal"),
|
||||
),
|
||||
)
|
||||
def test_invalid_kwarg_name_or_value( # TODO: move to `test_syntax_errors` ?
|
||||
def test_invalid_kwarg_name_or_value(
|
||||
expr: str, expected_error_msg: str, mark_matcher: MarkMatcher
|
||||
) -> None:
|
||||
with pytest.raises(ParseError, match=expected_error_msg):
|
||||
|
@ -289,7 +290,7 @@ def test_keyword_expressions_with_numbers(
|
|||
("builtin_matchers_mark(z=1)", False),
|
||||
),
|
||||
)
|
||||
def test_builtin_matchers_keyword_expressions( # TODO: naming when decided
|
||||
def test_builtin_matchers_keyword_expressions(
|
||||
expr: str, expected: bool, mark_matcher: MarkMatcher
|
||||
) -> None:
|
||||
assert evaluate(expr, mark_matcher) is expected
|
||||
|
|
Loading…
Reference in New Issue