Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ jobs:
fail-fast: false
matrix:
include:
- python-version: "3.9"
toxfactor: py3.9
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.10"
toxfactor: py3.10
ignore-typecheck-outcome: false
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ cover/

#PyCharm
/.idea

# Generated by the tox mypy env (poetry export)
/requirements.txt
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Deprecated

Removed
+++++++
* Dropped support for python 3.9 (end-of-life, and its locked dev dependencies had unfixable security alerts). Supported python versions: 3.10, 3.11, 3.12, 3.13, 3.14.
* The following private attributes are not available anymore (`#658 <https://github.com/pytest-dev/pytest-bdd/pull/658>`_):
* ``_pytest.reports.TestReport.scenario``; replaced by ``pytest_bdd.reporting.test_report_context`` WeakKeyDictionary (internal use)
* ``__scenario__`` attribute of test functions generated by the ``@scenario`` (and ``@scenarios``) decorator; replaced by ``pytest_bdd.scenario.scenario_wrapper_template_registry`` WeakKeyDictionary (internal use)
Expand Down
454 changes: 16 additions & 438 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@ classifiers = [
"Topic :: Software Development :: Libraries",
"Topic :: Utilities",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"Mako",
"parse",
Expand Down Expand Up @@ -74,7 +73,6 @@ build-backend = "poetry.core.masonry.api"

[tool.ruff]
line-length = 120
target-version = "py39"
lint.select = [
"B", # flake8-bugbear
"BLE", # flake8-blind-except
Expand Down
3 changes: 1 addition & 2 deletions src/pytest_bdd/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ def as_contexts(self) -> Generator[dict[str, str]]:
dict[str, str]: A dictionary mapping parameter names to their values for each example row.
"""
for row in self.examples:
assert len(self.example_params) == len(row)
yield dict(zip(self.example_params, row))
yield dict(zip(self.example_params, row, strict=True))

def __bool__(self) -> bool:
"""Check if there are any examples.
Expand Down
5 changes: 2 additions & 3 deletions src/pytest_bdd/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

from __future__ import annotations

from collections.abc import Generator
from typing import TYPE_CHECKING, Callable, TypeVar, cast
from collections.abc import Callable, Generator
from typing import TYPE_CHECKING, ParamSpec, TypeVar, cast

import pytest
from typing_extensions import ParamSpec

from . import cucumber_json, generation, gherkin_terminal_reporter, given, reporting, then, when
from .utils import CONFIG_STACK
Expand Down
3 changes: 2 additions & 1 deletion src/pytest_bdd/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
from __future__ import annotations

import time
from collections.abc import Callable
from dataclasses import dataclass
from typing import TYPE_CHECKING, Callable, TypedDict
from typing import TYPE_CHECKING, TypedDict
from weakref import WeakKeyDictionary

from typing_extensions import NotRequired
Expand Down
4 changes: 2 additions & 2 deletions src/pytest_bdd/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import logging
import os
import re
from collections.abc import Iterable, Iterator
from collections.abc import Callable, Iterable, Iterator
from inspect import signature
from typing import TYPE_CHECKING, Callable, TypeVar, cast
from typing import TYPE_CHECKING, TypeVar, cast
from weakref import WeakKeyDictionary

import pytest
Expand Down
5 changes: 2 additions & 3 deletions src/pytest_bdd/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@ def _(article):
from __future__ import annotations

import enum
from collections.abc import Iterable
from collections.abc import Callable, Iterable
from dataclasses import dataclass, field
from itertools import count
from typing import Callable, Literal, TypeVar
from typing import Literal, ParamSpec, TypeVar
from weakref import WeakKeyDictionary

import pytest
from typing_extensions import ParamSpec

from .parser import Step
from .parsers import StepParser, get_parser
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_bdd/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import typing

if typing.TYPE_CHECKING:
from typing_extensions import Literal
from typing import Literal

GIVEN: Literal["given"] = "given"
WHEN: Literal["when"] = "when"
Expand Down
3 changes: 2 additions & 1 deletion src/pytest_bdd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import base64
import pickle
import re
from collections.abc import Callable
from inspect import getframeinfo, signature
from sys import _getframe
from typing import TYPE_CHECKING, Callable, TypeVar, cast, overload
from typing import TYPE_CHECKING, TypeVar, cast, overload
from weakref import WeakKeyDictionary

if TYPE_CHECKING:
Expand Down
4 changes: 3 additions & 1 deletion tests/feature/test_gherkin_terminal_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def test_default_output_should_be_the_same_as_regular_terminal_reporter(pytester
def parse_lines(lines: list[str]) -> list[str]:
return [line for line in lines if not line.startswith("===")]

assert all(l1 == l2 for l1, l2 in zip(parse_lines(regular.stdout.lines), parse_lines(gherkin.stdout.lines)))
assert all(
l1 == l2 for l1, l2 in zip(parse_lines(regular.stdout.lines), parse_lines(gherkin.stdout.lines), strict=True)
)


def test_verbose_mode_should_display_feature_and_scenario_names_instead_of_test_names_in_a_single_line(pytester):
Expand Down
3 changes: 2 additions & 1 deletion tests/steps/test_common.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

import textwrap
from typing import Any, Callable
from collections.abc import Callable
from typing import Any
from unittest import mock

import pytest
Expand Down
8 changes: 6 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[tox]
envlist = py{3.9,3.10,3.11}-pytest{7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2,8.3,latest}-gherkin_official{29,30,32,33,34,35,36,37,latest}-coverage
py{3.12,3.13,3.14}-pytest{7.3,7.4,8.0,8.1,8.2,8.3,latest}-gherkin_official{29,30,32,33,34,35,36,37,latest}-coverage
# pytest 7.0-7.2 do not support python 3.12+
envlist = py{3.10,3.11}-pytest{7.0,7.1,7.2}-gherkin_official{29,30,32,33,34,35,36,37,latest}-coverage
py{3.10,3.11,3.12,3.13,3.14}-pytest{7.3,7.4,8.0,8.1,8.2,8.3,9.0,latest}-gherkin_official{29,30,32,33,34,35,36,37,latest}-coverage
py3.15-pytestlatest-gherkin_officiallatest-coverage
py3.12-pytestlatest-xdist-coverage
mypy
Expand All @@ -22,6 +23,9 @@ deps =
gherkin_official29: gherkin-official~=29.0.0

pytestlatest: pytest
pytest9.0: pytest~=9.0.0
pytest8.3: pytest~=8.3.0
pytest8.2: pytest~=8.2.0
pytest8.1: pytest~=8.1.0
pytest8.0: pytest~=8.0.0
pytest7.4: pytest~=7.4.0
Expand Down
Loading