From b9f9e92b36113b3404e286ad24e34b5acafa5ed3 Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Mon, 28 Feb 2022 13:12:37 +0300 Subject: [PATCH] tests: Sync expected stream for Pytest' version https://docs.pytest.org/en/7.0.x/changelog.html#breaking-changes: > [pytest#8246](https://github.com/pytest-dev/pytest/issues/8246): --version now writes version information to stdout rather than stderr. Fixes: https://github.com/pytest-dev/pytest-django/issues/995 Signed-off-by: Stanislav Levin --- tests/test_manage_py_scan.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/test_manage_py_scan.py b/tests/test_manage_py_scan.py index 39544589..b6b481ca 100644 --- a/tests/test_manage_py_scan.py +++ b/tests/test_manage_py_scan.py @@ -118,7 +118,13 @@ def test_django_project_found_invalid_settings_version(django_testdir, monkeypat result = django_testdir.runpytest_subprocess("django_project_root", "--version", "--version") assert result.ret == 0 - result.stderr.fnmatch_lines(["*This is pytest version*"]) + if result.errlines: + version_out = result.stderr + else: + # Pytest 7.0+ + version_out = result.stdout + + version_out.fnmatch_lines(["*This is pytest version*"]) result = django_testdir.runpytest_subprocess("django_project_root", "--help") assert result.ret == 0