Merge branch 'master' into docstrings

This commit is contained in:
jsa34 2024-10-16 06:59:27 +01:00 committed by GitHub
commit 3c3fa77ffb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 43 additions and 35 deletions

View File

@ -11,10 +11,6 @@ jobs:
strategy:
matrix:
include:
- python-version: "3.8"
toxfactor: py3.8
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.9"
toxfactor: py3.9
ignore-typecheck-outcome: false
@ -31,7 +27,7 @@ jobs:
toxfactor: py3.12
ignore-typecheck-outcome: false
ignore-test-outcome: false
- python-version: "3.13-dev"
- python-version: "3.13"
toxfactor: py3.13
ignore-typecheck-outcome: false
ignore-test-outcome: false

View File

@ -22,10 +22,12 @@ repos:
rev: v3.18.0
hooks:
- id: pyupgrade
args: ["--py38-plus"]
# TODO: Enable mypy checker when the checks succeed
#- repo: https://github.com/pre-commit/mirrors-mypy
# rev: v0.931
# hooks:
# - id: mypy
# additional_dependencies: [types-setuptools]
args: ["--py39-plus"]
- repo: https://github.com/pycqa/flake8
rev: "7.1.1"
hooks:
- id: flake8
additional_dependencies: [
"flake8-pyproject",
"flake8-bugbear",
]

View File

@ -3,6 +3,10 @@ Changelog
Unreleased
----------
- Dropped support for python 3.8. Supported python versions: 3.9, 3.10, 3.11, 3.12, 3.13.
8.0.0b2
----------
- Update documentation to clarify that `--gherkin-terminal-reporter` needs to be used with `-v` or `-vv`.
- Drop compatibility with pytest < 7.0.0.
- Continuation of steps using asterisks instead of And/But supported.

View File

@ -20,8 +20,6 @@ from importlib import metadata
sys.path.insert(0, os.path.abspath(".."))
import pytest_bdd
# -- General configuration -----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
@ -175,11 +173,11 @@ htmlhelp_basename = "Pytest-BDDdoc"
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# 'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "pytest-bdd"
version = "8.0.0b1"
version = "8.0.0b2"
description = "BDD for pytest"
authors = ["Oleg Pidsadnyi <oleg.pidsadnyi@gmail.com>", "Anatoly Bubenkov <bubenkoff@gmail.com>"]
maintainers = ["Alessio Bogon <778703+youtux@users.noreply.github.com>"]
@ -20,7 +20,6 @@ classifiers = [
"Topic :: Software Development :: Libraries",
"Topic :: Utilities",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
@ -58,7 +57,14 @@ build-backend = "poetry.core.masonry.api"
[tool.black]
line-length = 120
target-version = ["py38", "py39", "py310", "py311", "py312"]
target-version = ["py39", "py310", "py311", "py312", "py313"]
[tool.flake8]
# E1: indentation: already covered by `black`
# E2: whitespace: already covered by `black`
# E3: blank line: already covered by `black`
# E501: line length: already covered by `black`
extend-ignore = "E1,E2,E3,E501"
[tool.isort]
profile = "black"
@ -90,7 +96,7 @@ source = [
[tool.mypy]
python_version = "3.8"
python_version = "3.9"
warn_return_any = true
warn_unused_configs = true
files = "src/pytest_bdd/**/*.py"

View File

@ -16,7 +16,8 @@ from .steps import get_step_fixture_name
from .types import STEP_TYPES
if TYPE_CHECKING:
from typing import Any, Sequence
from collections.abc import Sequence
from typing import Any
from _pytest.config import Config
from _pytest.config.argparsing import Parser

View File

@ -4,8 +4,9 @@ import os.path
import re
import textwrap
from collections import OrderedDict
from collections.abc import Iterable, Mapping, Sequence
from dataclasses import dataclass, field
from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence
from typing import Any
from .exceptions import StepError
from .gherkin_parser import Background as GherkinBackground

View File

@ -4,7 +4,7 @@ from __future__ import annotations
import abc
import re as base_re
from typing import Any, Dict, TypeVar, cast, overload
from typing import Any, TypeVar, cast, overload
import parse as base_parse
from parse_type import cfparse as base_cfparse
@ -66,7 +66,7 @@ class parse(StepParser):
:return: `dict` of step arguments
"""
return cast(Dict[str, Any], self.parser.parse(name).named)
return cast(dict[str, Any], self.parser.parse(name).named)
def is_matching(self, name: str) -> bool:
"""Match given name with the step name."""

View File

@ -2,7 +2,8 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Callable, Generator, TypeVar, cast
from collections.abc import Generator
from typing import TYPE_CHECKING, Any, Callable, TypeVar, cast
import pytest
from typing_extensions import ParamSpec

View File

@ -17,7 +17,8 @@ import contextlib
import logging
import os
import re
from typing import TYPE_CHECKING, Any, Callable, Iterable, Iterator, List, TypeVar, cast
from collections.abc import Iterable, Iterator
from typing import TYPE_CHECKING, Any, Callable, TypeVar, cast
import pytest
from _pytest.fixtures import FixtureDef, FixtureManager, FixtureRequest, call_fixture_func
@ -50,7 +51,7 @@ def find_fixturedefs_for_step(step: Step, fixturemanager: FixtureManager, node:
# happens to be that _arg2fixturedefs is changed during the iteration so we use a copy
fixture_def_by_name = list(fixturemanager._arg2fixturedefs.items())
for fixturename, fixturedefs in fixture_def_by_name:
for pos, fixturedef in enumerate(fixturedefs):
for _, fixturedef in enumerate(fixturedefs):
step_func_context = getattr(fixturedef.func, "_pytest_bdd_step_context", None)
if step_func_context is None:
continue
@ -62,7 +63,7 @@ def find_fixturedefs_for_step(step: Step, fixturemanager: FixtureManager, node:
if not match:
continue
fixturedefs = cast(List[FixtureDef[Any]], getfixturedefs(fixturemanager, fixturename, node) or [])
fixturedefs = cast(list[FixtureDef[Any]], getfixturedefs(fixturemanager, fixturename, node) or [])
if fixturedef not in fixturedefs:
continue

View File

@ -38,9 +38,10 @@ def _(article):
from __future__ import annotations
import enum
from collections.abc import Iterable
from dataclasses import dataclass, field
from itertools import count
from typing import Any, Callable, Iterable, Literal, TypeVar
from typing import Any, Callable, Literal, TypeVar
import pytest
from typing_extensions import ParamSpec

View File

@ -1,5 +1,4 @@
import textwrap
from typing import List
from src.pytest_bdd.utils import collect_dumped_objects

View File

@ -8,8 +8,6 @@ import textwrap
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from typing import Optional
from _pytest.pytester import Pytester, RunResult

View File

@ -4,7 +4,7 @@ from unittest import mock
import pytest
from pytest_bdd import given, parser, parsers, then, when
from pytest_bdd import given, parsers, then, when
from pytest_bdd.utils import collect_dumped_objects

View File

@ -1,6 +1,6 @@
[tox]
distshare = {homedir}/.tox/distshare
envlist = py{3.8,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}-coverage
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}-coverage
py{3.12,3.13}-pytest{7.3,7.4,8.0,8.1,8.2,8.3,latest}-coverage
py3.12-pytestlatest-xdist-coverage
mypy