diff options
author | Bruno Oliveira <nicoddemus@gmail.com> | 2019-01-29 15:31:20 -0200 |
---|---|---|
committer | Bruno Oliveira <nicoddemus@gmail.com> | 2019-01-29 19:02:41 -0200 |
commit | eb92e575098f9e2e29bb0e69b173f794d9094498 (patch) | |
tree | bd0598705d0e9f0b42100531ff8837f764b5584c /testing/deprecated_test.py | |
parent | 6aba60ab08c9576b24ae5ec6bb09693f8ca82d84 (diff) | |
download | pytest-eb92e575098f9e2e29bb0e69b173f794d9094498.tar.gz |
Show deprecation message when running under Python 2.7 and 3.4
Fix #4627
Diffstat (limited to 'testing/deprecated_test.py')
-rw-r--r-- | testing/deprecated_test.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/testing/deprecated_test.py b/testing/deprecated_test.py index a6ef4739b..92cfcbff8 100644 --- a/testing/deprecated_test.py +++ b/testing/deprecated_test.py @@ -3,6 +3,7 @@ from __future__ import division from __future__ import print_function import os +import sys import pytest from _pytest.warnings import SHOW_PYTEST_WARNINGS_ARG @@ -219,3 +220,21 @@ def test_fixture_named_request(testdir): "*'request' is a reserved name for fixtures and will raise an error in future versions" ] ) + + +def test_python_deprecation(testdir): + result = testdir.runpytest() + python_ver = ".".join(str(x) for x in sys.version_info[:3]) + msg = "You are using Python {}, which will no longer be supported in pytest 5.0".format( + python_ver + ) + if sys.version_info[:2] <= (3, 4): + result.stdout.fnmatch_lines( + [ + msg, + "For more information, please read:", + " https://docs.pytest.org/en/latest/py27-py34-deprecation.html", + ] + ) + else: + assert msg not in result.stdout.str() |