Skip to content

Commit

Permalink
Drop compatibility with pytest < 7
Browse files Browse the repository at this point in the history
  • Loading branch information
youtux committed Sep 28, 2024
1 parent 168a8f9 commit 9a69a6e
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Changelog

Unreleased
----------
- Drop compatibility with pytest < 7.0.0.

8.0.0b1
----------
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/pytest_bdd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
2 changes: 1 addition & 1 deletion tests/generation/test_generate_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _(param):
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
Expand Down
4 changes: 2 additions & 2 deletions tests/scripts/test_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down Expand Up @@ -211,4 +211,4 @@ def _():
raise NotImplementedError
'''
)
assert result.stdout.str() == expected_output
assert str(result.stdout) == expected_output
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit 9a69a6e

Please sign in to comment.