Hello community, here is the log from the commit of package python-deprecation for openSUSE:Factory checked in at 2019-03-10 09:35:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-deprecation (Old) and /work/SRC/openSUSE:Factory/.python-deprecation.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-deprecation" Sun Mar 10 09:35:52 2019 rev:3 rq:682479 version:2.0.6 Changes: -------- --- /work/SRC/openSUSE:Factory/python-deprecation/python-deprecation.changes 2018-12-13 19:42:49.465139496 +0100 +++ /work/SRC/openSUSE:Factory/.python-deprecation.new.28833/python-deprecation.changes 2019-03-10 09:35:53.836168742 +0100 @@ -1,0 +2,8 @@ +Thu Mar 7 14:11:32 UTC 2019 - Tomáš Chvátal <tchva...@suse.com> + +- Update to 2.0.6: + * Use sphinx deprecated directive + * no upstream changelog +- Make sure to run tests + +------------------------------------------------------------------- Old: ---- deprecation-1.0.1.tar.gz New: ---- deprecation-2.0.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-deprecation.spec ++++++ --- /var/tmp/diff_new_pack.cBU4ex/_old 2019-03-10 09:35:54.372168614 +0100 +++ /var/tmp/diff_new_pack.cBU4ex/_new 2019-03-10 09:35:54.372168614 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-deprecation # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,16 +17,17 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -%bcond_without test Name: python-deprecation -Version: 1.0.1 +Version: 2.0.6 Release: 0 Summary: A library to handle automated deprecations License: Apache-2.0 Group: Development/Languages/Python -URL: http://deprecation.readthedocs.io/ +URL: https://github.com/briancurtin/deprecation Source: https://files.pythonhosted.org/packages/source/d/deprecation/deprecation-%{version}.tar.gz BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module unittest2} +BuildRequires: fdupes BuildRequires: python-rpm-macros BuildArch: noarch %python_subpackages @@ -45,6 +46,10 @@ %install %python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%python_exec setup.py test %files %{python_files} %license LICENSE ++++++ deprecation-1.0.1.tar.gz -> deprecation-2.0.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/deprecation-1.0.1/MANIFEST.in new/deprecation-2.0.6/MANIFEST.in --- old/deprecation-1.0.1/MANIFEST.in 2017-05-02 17:38:10.000000000 +0200 +++ new/deprecation-2.0.6/MANIFEST.in 2018-05-06 17:32:55.000000000 +0200 @@ -1 +1,2 @@ include LICENSE +include tests/*.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/deprecation-1.0.1/PKG-INFO new/deprecation-2.0.6/PKG-INFO --- old/deprecation-1.0.1/PKG-INFO 2017-05-02 17:43:42.000000000 +0200 +++ new/deprecation-2.0.6/PKG-INFO 2018-09-26 23:43:06.000000000 +0200 @@ -1,11 +1,16 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: deprecation -Version: 1.0.1 +Version: 2.0.6 Summary: A library to handle automated deprecations Home-page: http://deprecation.readthedocs.io/ Author: Brian Curtin Author-email: br...@python.org +Maintainer: Brian Curtin +Maintainer-email: br...@python.org License: Apache 2 +Project-URL: Documentation, http://deprecation.readthedocs.io/en/latest/ +Project-URL: Source, https://github.com/briancurtin/deprecation +Project-URL: Bug Tracker, https://github.com/briancurtin/deprecation/issues Description: deprecation =========== @@ -98,9 +103,9 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Software Development :: Libraries :: Python Modules diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/deprecation-1.0.1/deprecation.egg-info/PKG-INFO new/deprecation-2.0.6/deprecation.egg-info/PKG-INFO --- old/deprecation-1.0.1/deprecation.egg-info/PKG-INFO 2017-05-02 17:43:42.000000000 +0200 +++ new/deprecation-2.0.6/deprecation.egg-info/PKG-INFO 2018-09-26 23:43:06.000000000 +0200 @@ -1,11 +1,16 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: deprecation -Version: 1.0.1 +Version: 2.0.6 Summary: A library to handle automated deprecations Home-page: http://deprecation.readthedocs.io/ Author: Brian Curtin Author-email: br...@python.org +Maintainer: Brian Curtin +Maintainer-email: br...@python.org License: Apache 2 +Project-URL: Documentation, http://deprecation.readthedocs.io/en/latest/ +Project-URL: Source, https://github.com/briancurtin/deprecation +Project-URL: Bug Tracker, https://github.com/briancurtin/deprecation/issues Description: deprecation =========== @@ -98,9 +103,9 @@ Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 +Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Software Development :: Libraries :: Python Modules diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/deprecation-1.0.1/deprecation.egg-info/SOURCES.txt new/deprecation-2.0.6/deprecation.egg-info/SOURCES.txt --- old/deprecation-1.0.1/deprecation.egg-info/SOURCES.txt 2017-05-02 17:43:42.000000000 +0200 +++ new/deprecation-2.0.6/deprecation.egg-info/SOURCES.txt 2018-09-26 23:43:06.000000000 +0200 @@ -2,8 +2,12 @@ MANIFEST.in README.rst deprecation.py +setup.cfg setup.py deprecation.egg-info/PKG-INFO deprecation.egg-info/SOURCES.txt deprecation.egg-info/dependency_links.txt -deprecation.egg-info/top_level.txt \ No newline at end of file +deprecation.egg-info/requires.txt +deprecation.egg-info/top_level.txt +tests/__init__.py +tests/test_deprecation.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/deprecation-1.0.1/deprecation.egg-info/requires.txt new/deprecation-2.0.6/deprecation.egg-info/requires.txt --- old/deprecation-1.0.1/deprecation.egg-info/requires.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/deprecation-2.0.6/deprecation.egg-info/requires.txt 2018-09-26 23:43:06.000000000 +0200 @@ -0,0 +1 @@ +packaging diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/deprecation-1.0.1/deprecation.py new/deprecation-2.0.6/deprecation.py --- old/deprecation-1.0.1/deprecation.py 2017-01-14 17:34:42.000000000 +0100 +++ new/deprecation-2.0.6/deprecation.py 2018-09-26 23:42:03.000000000 +0200 @@ -9,17 +9,26 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - -from distutils import version +import collections import functools +import textwrap import warnings -__version__ = "1.0" +from packaging import version + +__version__ = "2.0.6" # This is mostly here so automodule docs are ordered more ideally. -__all__ = ["deprecated", "fail_if_not_removed", +__all__ = ["deprecated", "message_location", "fail_if_not_removed", "DeprecatedWarning", "UnsupportedWarning"] +#: Location where the details are added to a deprecated docstring +#: +#: When set to ``"bottom"``, the details are appended to the end. +#: When set to ``"top"``, the details are inserted between the +#: summary line and docstring contents. +message_location = "bottom" + class DeprecatedWarning(DeprecationWarning): """A warning class for deprecated methods @@ -47,12 +56,26 @@ self.deprecated_in = deprecated_in self.removed_in = removed_in self.details = details - super(DeprecatedWarning, self).__init__() + super(DeprecatedWarning, self).__init__(function, deprecated_in, + removed_in, details) def __str__(self): - return ("%s is deprecated as of %s and will " - "be removed in %s. %s" % (self.function, self.deprecated_in, - self.removed_in, self.details)) + # Use a defaultdict to give us the empty string + # when a part isn't included. + parts = collections.defaultdict(str) + parts["function"] = self.function + + if self.deprecated_in: + parts["deprecated"] = " as of %s" % self.deprecated_in + if self.removed_in: + parts["removed"] = " and will be removed in %s" % self.removed_in + if any([self.deprecated_in, self.removed_in, self.details]): + parts["period"] = "." + if self.details: + parts["details"] = " %s" % self.details + + return ("%(function)s is deprecated%(deprecated)s%(removed)s" + "%(period)s%(details)s" % (parts)) class UnsupportedWarning(DeprecatedWarning): @@ -66,9 +89,15 @@ """ def __str__(self): - return ("%s is unsupported as of %s. %s" % (self.function, - self.removed_in, - self.details)) + parts = collections.defaultdict(str) + parts["function"] = self.function + parts["removed"] = self.removed_in + + if self.details: + parts["details"] = " %s" % self.details + + return ("%(function)s is unsupported as of %(removed)s." + "%(details)s" % (parts)) def deprecated(deprecated_in=None, removed_in=None, current_version=None, @@ -128,13 +157,13 @@ # StrictVersion won't take a None or a "", so make whatever goes to it # is at least *something*. if current_version: - current_version = version.StrictVersion(current_version) + current_version = version.parse(current_version) if (removed_in - and current_version >= version.StrictVersion(removed_in)): + and current_version >= version.parse(removed_in)): is_unsupported = True elif (deprecated_in - and current_version >= version.StrictVersion(deprecated_in)): + and current_version >= version.parse(deprecated_in)): is_deprecated = True else: # If we can't actually calculate that we're in a period of @@ -156,19 +185,51 @@ # of the parts. parts = { "deprecated_in": - " in %s" % deprecated_in if deprecated_in else "", + " %s" % deprecated_in if deprecated_in else "", "removed_in": - ", to be removed in %s" % removed_in if removed_in else "", - "period": - "." if deprecated_in or removed_in or details else "", + "\n This will be removed in %s." % + removed_in if removed_in else "", "details": " %s" % details if details else ""} - deprecation_note = ("*Deprecated{deprecated_in}{removed_in}" - "{period}{details}*".format(**parts)) + deprecation_note = (".. deprecated::{deprecated_in}" + "{removed_in}{details}".format(**parts)) + + # default location for insertion of deprecation note + loc = 1 + + # split docstring at first occurrence of newline + string_list = existing_docstring.split("\n", 1) + + if len(string_list) > 1: + # With a multi-line docstring, when we modify + # existing_docstring to add our deprecation_note, + # if we're not careful we'll interfere with the + # indentation levels of the contents below the + # first line, or as PEP 257 calls it, the summary + # line. Since the summary line can start on the + # same line as the """, dedenting the whole thing + # won't help. Split the summary and contents up, + # dedent the contents independently, then join + # summary, dedent'ed contents, and our + # deprecation_note. + + # in-place dedent docstring content + string_list[1] = textwrap.dedent(string_list[1]) + + # we need another newline + string_list.insert(loc, "\n") + + # change the message_location if we add to end of docstring + # do this always if not "top" + if message_location != "top": + loc = 3 + + # insert deprecation note and dual newline + string_list.insert(loc, deprecation_note) + string_list.insert(loc, "\n\n") - function.__doc__ = "\n\n".join([existing_docstring, - deprecation_note]) + function.__doc__ = "".join(string_list) @functools.wraps(function) def _inner(*args, **kwargs): @@ -180,7 +241,8 @@ the_warning = cls(function.__name__, deprecated_in, removed_in, details) - warnings.warn(the_warning) + warnings.warn(the_warning, category=DeprecationWarning, + stacklevel=2) return function(*args, **kwargs) return _inner @@ -198,7 +260,9 @@ :class:`~deprecation.UnsupportedWarning` is raised while running the test method. """ - def _inner(*args, **kwargs): + # NOTE(briancurtin): Unless this is named test_inner, nose won't work + # properly. See Issue #32. + def test_inner(*args, **kwargs): with warnings.catch_warnings(record=True) as caught_warnings: warnings.simplefilter("always") rv = method(*args, **kwargs) @@ -209,4 +273,4 @@ ("%s uses a function that should be removed: %s" % (method, str(warning.message)))) return rv - return _inner + return test_inner diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/deprecation-1.0.1/setup.cfg new/deprecation-2.0.6/setup.cfg --- old/deprecation-1.0.1/setup.cfg 2017-05-02 17:43:42.000000000 +0200 +++ new/deprecation-2.0.6/setup.cfg 2018-09-26 23:43:06.000000000 +0200 @@ -1,5 +1,7 @@ +[bdist_wheel] +universal = 1 + [egg_info] tag_build = tag_date = 0 -tag_svn_revision = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/deprecation-1.0.1/setup.py new/deprecation-2.0.6/setup.py --- old/deprecation-1.0.1/setup.py 2017-05-02 17:41:48.000000000 +0200 +++ new/deprecation-2.0.6/setup.py 2018-06-20 17:41:38.000000000 +0200 @@ -1,12 +1,29 @@ import io +import re + from setuptools import setup AUTHOR = "Brian Curtin" EMAIL = "br...@python.org" +def _read_file(): + with open("deprecation.py", "r") as f: + return f.read() + + +FILE = _read_file() + + +def get_version(): + match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", FILE, re.M) + if match: + return match.group(1) + raise RuntimeError("Unable to find __version__ string.") + + setup(name="deprecation", - version="1.0.1", + version=get_version(), description="A library to handle automated deprecations", license="Apache 2", url="http://deprecation.readthedocs.io/", @@ -14,20 +31,25 @@ author_email=EMAIL, maintainer=AUTHOR, maintainer_email=EMAIL, + install_requires=["packaging"], keywords=["deprecation"], long_description=io.open("README.rst", encoding="utf-8").read(), py_modules=["deprecation"], classifiers=[ - "Development Status :: 5 - Production/Stable", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - "Topic :: Software Development :: Libraries :: Python Modules"] + "Development Status :: 5 - Production/Stable", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Software Development :: Libraries :: Python Modules"], + project_urls={ + "Documentation": "http://deprecation.readthedocs.io/en/latest/", + "Source": "https://github.com/briancurtin/deprecation", + "Bug Tracker": "https://github.com/briancurtin/deprecation/issues"}, ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/deprecation-1.0.1/tests/test_deprecation.py new/deprecation-2.0.6/tests/test_deprecation.py --- old/deprecation-1.0.1/tests/test_deprecation.py 1970-01-01 01:00:00.000000000 +0100 +++ new/deprecation-2.0.6/tests/test_deprecation.py 2018-09-26 23:40:29.000000000 +0200 @@ -0,0 +1,226 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# As we unfortunately support Python 2.7, it lacks TestCase.subTest which +# is in 3.4+ or in unittest2 +import unittest2 +import warnings + +import deprecation + + +class Test_deprecated(unittest2.TestCase): + + def test_args_set_on_base_class(self): + args = (1, 2, 3, 4) + dw = deprecation.DeprecatedWarning(*args) + self.assertEqual(dw.args, args) + + def test_removing_without_deprecating(self): + self.assertRaises(TypeError, deprecation.deprecated, + deprecated_in=None, removed_in="1.0") + + def test_docstring(self): + for test in [{"args": {}, + "__doc__": "docstring\n\n.. deprecated::"}, + {"args": {"deprecated_in": "1.0"}, + "__doc__": "docstring\n\n.. deprecated:: 1.0"}, + {"args": {"deprecated_in": "1.0", "removed_in": "2.0"}, + "__doc__": "docstring\n\n.. deprecated:: 1.0" + "\n This will be removed in 2.0."}, + {"args": {"deprecated_in": "1.0", "removed_in": "2.0", + "details": "some details"}, + "__doc__": "docstring\n\n.. deprecated:: 1.0" + "\n This will be removed in 2.0. " + "some details"}]: + with self.subTest(**test): + @deprecation.deprecated(**test["args"]) + def fn(): + """docstring""" + + self.assertEqual(fn.__doc__, test["__doc__"]) + + def test_multiline_docstring(self): + docstring = "summary line\n\ndetails\nand more details\n" + for test in [{"args": {}, + "__doc__": "%s\n\n.. deprecated::"}, + {"args": {"deprecated_in": "1.0"}, + "__doc__": "%s\n\n.. deprecated:: 1.0"}, + {"args": {"deprecated_in": "1.0", "removed_in": "2.0"}, + "__doc__": "%s\n\n.. deprecated:: 1.0" + "\n This will be removed in 2.0."}, + {"args": {"deprecated_in": "1.0", "removed_in": "2.0", + "details": "some details"}, + "__doc__": "%s\n\n.. deprecated:: 1.0" + "\n This will be removed in 2.0. " + "some details"}]: + with self.subTest(**test): + @deprecation.deprecated(**test["args"]) + def fn(): + """summary line + + details + and more details + """ + + self.assertEqual(fn.__doc__, test["__doc__"] % (docstring)) + + def test_multiline_docstring_top(self): + summary = "summary line" + content = "\n\ndetails\nand more details\n" + for test in [{"args": {}, + "__doc__": "%s\n\n.. deprecated::%s"}, + {"args": {"deprecated_in": "1.0"}, + "__doc__": "%s\n\n.. deprecated:: 1.0%s"}, + {"args": {"deprecated_in": "1.0", "removed_in": "2.0"}, + "__doc__": "%s\n\n.. deprecated:: 1.0" + "\n This will be removed in 2.0.%s"}, + {"args": {"deprecated_in": "1.0", "removed_in": "2.0", + "details": "some details"}, + "__doc__": "%s\n\n.. deprecated:: 1.0" + "\n This will be removed in 2.0. " + "some details%s"}]: + with self.subTest(**test): + deprecation.message_location = "top" + + @deprecation.deprecated(**test["args"]) + def fn(): + """summary line + + details + and more details + """ + + self.assertEqual(fn.__doc__, test["__doc__"] % (summary, + content)) + + def test_multiline_fallback(self): + docstring = "summary line\n\ndetails\nand more details\n" + for test in [{"args": {"deprecated_in": "1.0"}, + "__doc__": "%s\n\n.. deprecated:: 1.0"}]: + with self.subTest(**test): + deprecation.message_location = "pot" + + @deprecation.deprecated(**test["args"]) + def fn(): + """summary line + + details + and more details + """ + + self.assertEqual(fn.__doc__, test["__doc__"] % (docstring)) + + def test_warning_raised(self): + ret_val = "lololol" + + for test in [{"args": {}, # No args just means deprecated + "warning": deprecation.DeprecatedWarning, + "message": "method is deprecated"}, + {"args": {"details": "do something else."}, + "warning": deprecation.DeprecatedWarning, + "message": "method is deprecated. do something else."}, + {"args": {"deprecated_in": "1.0", + "current_version": "2.0"}, + "warning": deprecation.DeprecatedWarning, + "message": "method is deprecated as of 1.0."}, + {"args": {"deprecated_in": "1.0", + "removed_in": "3.0", + "current_version": "2.0"}, + "warning": deprecation.DeprecatedWarning, + "message": ("method is deprecated as of 1.0 " + "and will be removed in 3.0.")}, + {"args": {"deprecated_in": "1.0", + "removed_in": "2.0", + "current_version": "2.0"}, + "warning": deprecation.UnsupportedWarning, + "message": "method is unsupported as of 2.0."}, + {"args": {"deprecated_in": "1.0", + "removed_in": "2.0", + "current_version": "2.0", + "details": "do something else."}, + "warning": deprecation.UnsupportedWarning, + "message": ("method is unsupported as of 2.0. " + "do something else.")}]: + with self.subTest(**test): + class Test(object): + @deprecation.deprecated(**test["args"]) + def method(self): + return ret_val + + with warnings.catch_warnings(record=True) as caught_warnings: + warnings.simplefilter("always") + + sot = Test() + self.assertEqual(ret_val, sot.method()) + + self.assertEqual(len(caught_warnings), 1) + self.assertEqual(caught_warnings[0].category, test["warning"]) + self.assertEqual(str(caught_warnings[0].message), + test["message"]) + + def test_DeprecatedWarning_not_raised(self): + ret_val = "lololol" + + class Test(object): + @deprecation.deprecated(deprecated_in="2.0", + removed_in="3.0", + current_version="1.0") + def method(self): + """method docstring""" + return ret_val + + with warnings.catch_warnings(record=True): + # If a warning is raised it'll be an exception, so we'll fail. + warnings.simplefilter("error") + + sot = Test() + self.assertEqual(sot.method(), ret_val) + + +class Test_fail_if_not_removed(unittest2.TestCase): + + @deprecation.deprecated(deprecated_in="1.0", current_version="2.0") + def _deprecated_method(self): + pass + + @deprecation.deprecated(deprecated_in="1.0", removed_in="2.0", + current_version="2.0") + def _unsupported_method(self): + pass + + def test_UnsupportedWarning_causes_failure(self): + with self.assertRaises(AssertionError): + @deprecation.fail_if_not_removed + def fn(): + self._unsupported_method() + + fn() + + def test_DeprecatedWarning_doesnt_fail(self): + @deprecation.fail_if_not_removed + def fn(): + self._deprecated_method() + + try: + fn() + except AssertionError: + self.fail("A DeprecatedWarning shouldn't cause a failure") + + @unittest2.expectedFailure + @deprecation.fail_if_not_removed + def test_literal_UnsupportedWarning(self): + self._unsupported_method() + + @deprecation.fail_if_not_removed + def test_literal_DeprecatedWarning(self): + self._deprecated_method()