From b38fad4b82123b392409fe78be01db2f39c7985b Mon Sep 17 00:00:00 2001 From: nmundar Date: Sat, 26 Nov 2016 12:22:58 +0100 Subject: [PATCH 1/4] Add compatproperty deprecation warning. --- _pytest/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_pytest/main.py b/_pytest/main.py index dd0775501..33d7ef432 100644 --- a/_pytest/main.py +++ b/_pytest/main.py @@ -190,7 +190,9 @@ class FSHookProxy: def compatproperty(name): def fget(self): - # deprecated - use pytest.name + import warnings + warnings.warn("compatproperty is deprecated. Use pytest.name", + PendingDeprecationWarning, stacklevel=2) return getattr(pytest, name) return property(fget) From 0e6ad8e59f7ee25860c2cf4626d26f2dabd37ef5 Mon Sep 17 00:00:00 2001 From: nmundar Date: Sat, 26 Nov 2016 12:36:32 +0100 Subject: [PATCH 2/4] update CHANGELOG and AUTHORS --- AUTHORS | 1 + CHANGELOG.rst | 3 +++ 2 files changed, 4 insertions(+) diff --git a/AUTHORS b/AUTHORS index d8fb8f703..8c7cb19ce 100644 --- a/AUTHORS +++ b/AUTHORS @@ -104,6 +104,7 @@ Michael Droettboom Michael Seifert Mike Lundy Ned Batchelder +Neven Mundar Nicolas Delaby Oleg Pidsadnyi Oliver Bestwalter diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8fb7b1589..1820e083a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,9 @@ * Provide ``:ref:`` targets for ``recwarn.rst`` so we can use intersphinx referencing. Thanks to `@dupuy`_ for the report and `@lwm`_ for the PR. +* Using ``pytest.main.compatproperty`` is now issuing deprecation warning. + Thanks `@nmundar` for the PR. + * An error message is now displayed if ``--confcutdir`` is not a valid directory, avoiding subtle bugs (`#2078`_). Thanks `@nicoddemus`_ for the PR. From 0a30f072e65da60f284af399e55c2ec897afb9cd Mon Sep 17 00:00:00 2001 From: nmundar Date: Sat, 26 Nov 2016 21:37:43 +0100 Subject: [PATCH 3/4] Show name argment in compatproperty deprecation message --- _pytest/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_pytest/main.py b/_pytest/main.py index 33d7ef432..2b5b12875 100644 --- a/_pytest/main.py +++ b/_pytest/main.py @@ -191,7 +191,7 @@ class FSHookProxy: def compatproperty(name): def fget(self): import warnings - warnings.warn("compatproperty is deprecated. Use pytest.name", + warnings.warn("This usage is deprecated, please use pytest.{0} instead".format(name), PendingDeprecationWarning, stacklevel=2) return getattr(pytest, name) From 2d7197926a8a2bb1cb8aebbe1fcb86e99837cad8 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Sun, 27 Nov 2016 14:19:29 -0200 Subject: [PATCH 4/4] Improve CHANGELOG entry for #2034 --- CHANGELOG.rst | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1820e083a..77b67ddbb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,13 +1,14 @@ 3.0.5.dev0 ========== -* Add hint to error message hinting possible missing __init__.py (`#478`_). Thanks `@DuncanBetts`_. +* Add hint to error message hinting possible missing ``__init__.py`` (`#478`_). Thanks `@DuncanBetts`_. * Provide ``:ref:`` targets for ``recwarn.rst`` so we can use intersphinx referencing. Thanks to `@dupuy`_ for the report and `@lwm`_ for the PR. -* Using ``pytest.main.compatproperty`` is now issuing deprecation warning. - Thanks `@nmundar` for the PR. +* Using ``item.Function``, ``item.Module``, etc., is now issuing deprecation warnings, prefer + ``pytest.Function``, ``pytest.Module``, etc., instead (`#2034`_). + Thanks `@nmundar`_ for the PR. * An error message is now displayed if ``--confcutdir`` is not a valid directory, avoiding subtle bugs (`#2078`_). @@ -30,8 +31,10 @@ .. _@adler-j: https://github.com/adler-j .. _@DuncanBetts: https://github.com/DuncanBetts .. _@nedbat: https://github.com/nedbat +.. _@nmundar: https://github.com/nmundar .. _#478: https://github.com/pytest-dev/pytest/issues/478 +.. _#2034: https://github.com/pytest-dev/pytest/issues/2034 .. _#2038: https://github.com/pytest-dev/pytest/issues/2038 .. _#2078: https://github.com/pytest-dev/pytest/issues/2078 .. _#2082: https://github.com/pytest-dev/pytest/issues/2082