From 66eff85e5424f0274e15081eb4185a2e23b4c167 Mon Sep 17 00:00:00 2001 From: lovetheguitar Date: Sat, 22 Jun 2024 19:48:15 +0200 Subject: [PATCH 01/12] docs: use double quotes for cross-platform compatibility in example code --- doc/en/example/markers.rst | 2 +- doc/en/how-to/usage.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/en/example/markers.rst b/doc/en/example/markers.rst index 159ff2cd1..babcd9e2f 100644 --- a/doc/en/example/markers.rst +++ b/doc/en/example/markers.rst @@ -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 diff --git a/doc/en/how-to/usage.rst b/doc/en/how-to/usage.rst index 05ee04600..0e0a0310f 100644 --- a/doc/en/how-to/usage.rst +++ b/doc/en/how-to/usage.rst @@ -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 `. From 73bc35ce2b22723a87c26cad6aa7835dcdc060cf Mon Sep 17 00:00:00 2001 From: lovetheguitar Date: Sat, 22 Jun 2024 19:49:59 +0200 Subject: [PATCH 02/12] docs(expression.py): correct grammar definition of lexer --- src/_pytest/mark/expression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/mark/expression.py b/src/_pytest/mark/expression.py index 3f4071dce..3b7f4c51b 100644 --- a/src/_pytest/mark/expression.py +++ b/src/_pytest/mark/expression.py @@ -5,7 +5,7 @@ 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 ('(' name '=' value ( ', ' name '=' value )* ')')? ident: (\w|:|\+|-|\.|\[|\]|\\|/)+ From 3cce243774b03125bb123a7b69f684ea0abba34b Mon Sep 17 00:00:00 2001 From: lovetheguitar Date: Sat, 22 Jun 2024 19:50:26 +0200 Subject: [PATCH 03/12] docs(expression.py): fix typo --- src/_pytest/mark/expression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_pytest/mark/expression.py b/src/_pytest/mark/expression.py index 3b7f4c51b..2067110d2 100644 --- a/src/_pytest/mark/expression.py +++ b/src/_pytest/mark/expression.py @@ -12,7 +12,7 @@ ident: (\w|:|\+|-|\.|\[|\]|\\|/)+ 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. """ From d582dcfc1676b1a35fe3c2d34be211d855a4afdb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Jun 2024 18:21:02 -0300 Subject: [PATCH 04/12] build(deps): Bump peter-evans/create-pull-request from 6.0.5 to 6.1.0 (#12527) Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6.0.5 to 6.1.0. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/6d6857d36972b65feb161a90e484f2984215f83e...c5a7806660adbe173f04e3e038b0ccdcd758773c) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/update-plugin-list.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-plugin-list.yml b/.github/workflows/update-plugin-list.yml index 4da55e6d5..ade8452af 100644 --- a/.github/workflows/update-plugin-list.yml +++ b/.github/workflows/update-plugin-list.yml @@ -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 ' From 77416d64f5af575460b001c768ced541564a902b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 25 Jun 2024 04:26:26 +0000 Subject: [PATCH 05/12] [pre-commit.ci] pre-commit autoupdate (#12528) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.4.9 → v0.4.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.9...v0.4.10) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c85175f29..56d9a0c86 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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"] From 2b7eadf09042759c641f775a2541332eba52b5ad Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 25 Jun 2024 07:24:50 +0200 Subject: [PATCH 06/12] Update trainings (#12514) --- doc/en/index.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/en/index.rst b/doc/en/index.rst index 58527ea73..8de3b3993 100644 --- a/doc/en/index.rst +++ b/doc/en/index.rst @@ -4,8 +4,7 @@ .. sidebar:: **Next Open Trainings and Events** - - `pytest development sprint `_, **June 17th -- 22nd 2024**, Klaus (AT) / Remote - - `pytest tips and tricks for a better testsuite `_, at `Europython 2024 `_, **July 8th -- 14th 2024** (3h), Prague (CZ) + - `pytest tips and tricks for a better testsuite `_, at `Europython 2024 `_, **July 9th 2024** (3h), Prague (CZ) - `pytest: Professionelles Testen (nicht nur) für Python `_, at `CH Open Workshoptage `_, **September 2nd 2024**, HSLU Rotkreuz (CH) - `Professional Testing with Python `_, via `Python Academy `_ (3 day in-depth training), **March 4th -- 6th 2025**, Leipzig (DE) / Remote From 540ede34397600794e2979f2ee952bb999496582 Mon Sep 17 00:00:00 2001 From: lovetheguitar Date: Sat, 22 Jun 2024 19:57:05 +0200 Subject: [PATCH 07/12] docs(expression.py): describe new `name` & `value` productions --- src/_pytest/mark/expression.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/_pytest/mark/expression.py b/src/_pytest/mark/expression.py index 2067110d2..0daaaf22f 100644 --- a/src/_pytest/mark/expression.py +++ b/src/_pytest/mark/expression.py @@ -8,12 +8,15 @@ and_expr: not_expr ('and' not_expr)* not_expr: 'not' not_expr | '(' expr ')' | ident ('(' name '=' value ( ', ' name '=' value )* ')')? ident: (\w|:|\+|-|\.|\[|\]|\\|/)+ +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 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 From dd5719695376b19c2ad9db0789a08f459ad7c9fb Mon Sep 17 00:00:00 2001 From: lovetheguitar Date: Sat, 22 Jun 2024 20:44:50 +0200 Subject: [PATCH 08/12] perf(expression): define `TokenType.STRING` as "string literal" for clearer errors --- src/_pytest/mark/expression.py | 2 +- testing/test_mark_expression.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/_pytest/mark/expression.py b/src/_pytest/mark/expression.py index 0daaaf22f..ce98e9c7e 100644 --- a/src/_pytest/mark/expression.py +++ b/src/_pytest/mark/expression.py @@ -51,7 +51,7 @@ class TokenType(enum.Enum): IDENT = "identifier" EOF = "end of input" EQUAL = "=" - STRING = "str" + STRING = "string literal" COMMA = "," diff --git a/testing/test_mark_expression.py b/testing/test_mark_expression.py index c31ab4470..b5f1f330a 100644 --- a/testing/test_mark_expression.py +++ b/testing/test_mark_expression.py @@ -228,6 +228,7 @@ 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` ? From 3d07791c36804a0ebcd6b0446f852e8e6745d30d Mon Sep 17 00:00:00 2001 From: lovetheguitar Date: Sat, 22 Jun 2024 20:49:21 +0200 Subject: [PATCH 09/12] chore: remove obsolete `TODO`s --- testing/test_mark.py | 2 +- testing/test_mark_expression.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/testing/test_mark.py b/testing/test_mark.py index 6a94cc9f7..89eef7920 100644 --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -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"]), diff --git a/testing/test_mark_expression.py b/testing/test_mark_expression.py index b5f1f330a..f8f5f9221 100644 --- a/testing/test_mark_expression.py +++ b/testing/test_mark_expression.py @@ -231,7 +231,7 @@ def test_invalid_idents(ident: str) -> None: ("'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): @@ -290,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 From 36b384afc7c2457a2772abcef1f3270a7067d0cb Mon Sep 17 00:00:00 2001 From: lovetheguitar Date: Tue, 25 Jun 2024 09:16:57 +0200 Subject: [PATCH 10/12] docs(expression.py): simplify grammar documentation by defining `kwargs` separately --- src/_pytest/mark/expression.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/_pytest/mark/expression.py b/src/_pytest/mark/expression.py index ce98e9c7e..89cc0e94d 100644 --- a/src/_pytest/mark/expression.py +++ b/src/_pytest/mark/expression.py @@ -5,9 +5,10 @@ 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' From 29e4b6b9f010828594df599fcf0b6164a59da27b Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Wed, 26 Jun 2024 14:16:30 +0200 Subject: [PATCH 11/12] =?UTF-8?q?=F0=9F=93=9D=F0=9F=94=A5=20Remove=20the?= =?UTF-8?q?=20`:bpo:`=20RST=20role=20declaration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BPO is in read-only mode and all issues have been migrated to GitHub. This patch replaces the use of that role with `:issue:`, recently integrated via #12522. It also disables the built-in `extlinks` Sphinx extension, as it's no longer in use. --- doc/en/changelog.rst | 4 +++- doc/en/conf.py | 6 ------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/doc/en/changelog.rst b/doc/en/changelog.rst index 2c07f208a..8e3efd047 100644 --- a/doc/en/changelog.rst +++ b/doc/en/changelog.rst @@ -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). diff --git a/doc/en/conf.py b/doc/en/conf.py index 7ec862a60..0d440ec44 100644 --- a/doc/en/conf.py +++ b/doc/en/conf.py @@ -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?) From d75fa9f9b420124b1ad3ee5a43d04367dba3054c Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Wed, 26 Jun 2024 14:22:56 +0200 Subject: [PATCH 12/12] =?UTF-8?q?=F0=9F=93=9D=20Add=20a=20change=20note=20?= =?UTF-8?q?for=20PE=20#12533?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- changelog/12533.contrib.rst | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 changelog/12533.contrib.rst diff --git a/changelog/12533.contrib.rst b/changelog/12533.contrib.rst new file mode 100644 index 000000000..3da7007a0 --- /dev/null +++ b/changelog/12533.contrib.rst @@ -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`