Drop compatibility with pytest < 7

This commit is contained in:
Alessio Bogon 2024-09-28 18:28:50 +02:00
parent 168a8f9fd6
commit 9a69a6ecfc
No known key found for this signature in database
6 changed files with 7 additions and 7 deletions

View File

@ -3,6 +3,7 @@ Changelog
Unreleased
----------
- Drop compatibility with pytest < 7.0.0.
8.0.0b1
----------

View File

@ -39,7 +39,7 @@ python = ">=3.8"
Mako = "*"
parse = "*"
parse-type = "*"
pytest = ">=6.2.0"
pytest = ">=7.0.0"
typing-extensions = "*"
packaging = "*"
gherkin-official = "^29.0.0"

View File

@ -71,7 +71,7 @@ def collect_dumped_objects(result: RunResult) -> list:
Note: You must run the result with output to stdout enabled.
For example, using ``pytester.runpytest("-s")``.
"""
stdout = result.stdout.str() # pytest < 6.2, otherwise we could just do str(result.stdout)
stdout = str(result.stdout)
payloads = re.findall(rf"{_DUMP_START}(.*?){_DUMP_END}", stdout)
return [pickle.loads(base64.b64decode(payload)) for payload in payloads]

View File

@ -137,7 +137,7 @@ def test_generate_missing_with_step_parsers(pytester):
assert not result.stderr.str()
assert result.ret == 0
output = result.stdout.str()
output = str(result.stdout)
assert "I use the string parser" not in output
assert "I use parsers.parse" not in output

View File

@ -100,7 +100,7 @@ def test_generate_with_quotes(pytester):
)
result = pytester.run("pytest-bdd", "generate", "generate_with_quotes.feature")
assert result.stdout.str() == textwrap.dedent(
assert str(result.stdout) == textwrap.dedent(
'''\
"""Handling quotes in code generation feature tests."""
@ -211,4 +211,4 @@ def test_unicode_characters(pytester, monkeypatch):
raise NotImplementedError
'''
)
assert result.stdout.str() == expected_output
assert str(result.stdout) == expected_output

View File

@ -1,6 +1,6 @@
[tox]
distshare = {homedir}/.tox/distshare
envlist = py{3.8,3.9,3.10,3.11}-pytest{6.2,7.0,7.1,7.2,7.3,7.4,8.0,8.1,8.2,8.3,latest}-coverage
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
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
@ -19,7 +19,6 @@ deps =
pytest7.2: pytest~=7.2.0
pytest7.1: pytest~=7.1.0
pytest7.0: pytest~=7.0.0
pytest6.2: pytest~=6.2.0
coverage: coverage[toml]
xdist: pytest-xdist