Hello community,
here is the log from the commit of package python-Deprecated for
openSUSE:Factory checked in at 2020-01-13 22:22:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-Deprecated (Old)
and /work/SRC/openSUSE:Factory/.python-Deprecated.new.6675 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Deprecated"
Mon Jan 13 22:22:42 2020 rev:3 rq:764062 version:1.2.7
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-Deprecated/python-Deprecated.changes
2019-07-22 17:18:29.093953958 +0200
+++
/work/SRC/openSUSE:Factory/.python-Deprecated.new.6675/python-Deprecated.changes
2020-01-13 22:22:48.334553885 +0100
@@ -1,0 +2,8 @@
+Mon Jan 13 15:06:49 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- update to 1.2.7
+ * Fix: Warning displays the correct filename and line number when
+ decorating a function if wrapt does not have the compiled c extension.
+ * Add Black configuration file.
+
+-------------------------------------------------------------------
Old:
----
Deprecated-1.2.6.tar.gz
New:
----
Deprecated-1.2.7.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-Deprecated.spec ++++++
--- /var/tmp/diff_new_pack.OwLPuD/_old 2020-01-13 22:22:48.998554193 +0100
+++ /var/tmp/diff_new_pack.OwLPuD/_new 2020-01-13 22:22:49.002554195 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-Deprecated
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-Deprecated
-Version: 1.2.6
+Version: 1.2.7
Release: 0
Summary: Python @deprecated decorator
License: MIT
++++++ Deprecated-1.2.6.tar.gz -> Deprecated-1.2.7.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/.bumpversion.cfg
new/Deprecated-1.2.7/.bumpversion.cfg
--- old/Deprecated-1.2.6/.bumpversion.cfg 2019-07-06 15:07:23.000000000
+0200
+++ new/Deprecated-1.2.7/.bumpversion.cfg 2019-10-02 20:18:27.000000000
+0200
@@ -1,5 +1,5 @@
[bumpversion]
-current_version = 1.2.6
+current_version = 1.2.7
commit = True
tag = False
message = Prepare next version {new_version} (unreleased)
@@ -16,3 +16,7 @@
search = release = "{current_version}"
replace = release = "{new_version}"
+[bumpversion:file:python-deprecated.spec]
+search = (?<=Version:\s+){current_version}
+replace = {new_version}
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/.travis.yml
new/Deprecated-1.2.7/.travis.yml
--- old/Deprecated-1.2.6/.travis.yml 2018-11-03 20:57:22.000000000 +0100
+++ new/Deprecated-1.2.7/.travis.yml 2019-11-11 14:45:11.000000000 +0100
@@ -5,9 +5,9 @@
- "3.4"
- "3.5"
- "3.6"
- # - "3.7" # Not available yet (Unable to download 3.7 archive).
- - "3.7-dev" # 3.7 development branch
- - "nightly" # currently points to 3.7-dev
+ - "3.7"
+ - "3.8"
+ - "3.8-dev" # 3.8 development branch
# - "pypy" # some unit tests fail
install:
- pip install tox-travis
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/CHANGELOG.rst
new/Deprecated-1.2.7/CHANGELOG.rst
--- old/Deprecated-1.2.6/CHANGELOG.rst 2019-07-06 21:40:15.000000000 +0200
+++ new/Deprecated-1.2.7/CHANGELOG.rst 2019-11-11 16:04:12.000000000 +0100
@@ -18,6 +18,26 @@
(only in comment or documentation).
+v1.2.7 (2019-11-11)
+===================
+
+Bug fix release
+
+Fix
+---
+
+- Warning displays the correct filename and line number when decorating a
function if wrapt
+ does not have the compiled c extension.
+
+Other
+-----
+
+- Support packit for Pull Request tests and sync to Fedora (thanks to Petr
Hráček).
+ Supported since v1.2.6.
+
+- Add `Black <https://black.readthedocs.io/en/latest/>`_ configuration file.
+
+
v1.2.6 (2019-07-06)
===================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/Deprecated.egg-info/PKG-INFO
new/Deprecated-1.2.7/Deprecated.egg-info/PKG-INFO
--- old/Deprecated-1.2.6/Deprecated.egg-info/PKG-INFO 2019-07-06
21:40:44.000000000 +0200
+++ new/Deprecated-1.2.7/Deprecated.egg-info/PKG-INFO 2019-11-11
16:04:57.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: Deprecated
-Version: 1.2.6
+Version: 1.2.7
Summary: Python @deprecated decorator to deprecate old python classes,
functions or methods.
Home-page: https://github.com/tantale/deprecated
Author: Laurent LAPORTE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/Deprecated.egg-info/SOURCES.txt
new/Deprecated-1.2.7/Deprecated.egg-info/SOURCES.txt
--- old/Deprecated-1.2.6/Deprecated.egg-info/SOURCES.txt 2019-07-06
21:40:44.000000000 +0200
+++ new/Deprecated-1.2.7/Deprecated.egg-info/SOURCES.txt 2019-11-11
16:04:57.000000000 +0100
@@ -49,8 +49,6 @@
docs/source/tutorial/v4/using_liberty.py
docs/source/tutorial/v5/sphinx_demo.py
tests/__init__.py
-tests/demo_classic_usage.py
-tests/demo_classic_usage2.py
tests/test.py
tests/test_deprecated.py
tests/test_deprecated_class.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/PKG-INFO
new/Deprecated-1.2.7/PKG-INFO
--- old/Deprecated-1.2.6/PKG-INFO 2019-07-06 21:40:44.000000000 +0200
+++ new/Deprecated-1.2.7/PKG-INFO 2019-11-11 16:05:00.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: Deprecated
-Version: 1.2.6
+Version: 1.2.7
Summary: Python @deprecated decorator to deprecate old python classes,
functions or methods.
Home-page: https://github.com/tantale/deprecated
Author: Laurent LAPORTE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/deprecated/__init__.py
new/Deprecated-1.2.7/deprecated/__init__.py
--- old/Deprecated-1.2.6/deprecated/__init__.py 2019-07-06 15:07:23.000000000
+0200
+++ new/Deprecated-1.2.7/deprecated/__init__.py 2019-10-02 20:18:27.000000000
+0200
@@ -8,6 +8,6 @@
"""
#: Module Version Number, see `PEP 396
<https://www.python.org/dev/peps/pep-0396/>`_.
-__version__ = "1.2.6"
+__version__ = "1.2.7"
from deprecated.classic import deprecated
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/deprecated/classic.py
new/Deprecated-1.2.7/deprecated/classic.py
--- old/Deprecated-1.2.6/deprecated/classic.py 2019-02-28 13:44:56.000000000
+0100
+++ new/Deprecated-1.2.7/deprecated/classic.py 2019-11-11 14:45:11.000000000
+0100
@@ -12,6 +12,16 @@
import wrapt
+try:
+ # If the c extension for wrapt was compiled and wrapt/_wrappers.pyd
exists, then the
+ # stack level that should be passed to warnings.warn should be 2. However,
if using
+ # a pure python wrapt, a extra stacklevel is required.
+ import wrapt._wrappers
+ _stacklevel = 2
+except ImportError:
+ _stacklevel = 3
+
+
string_types = (type(b''), type(u''))
@@ -122,9 +132,7 @@
fmt += " ({reason})"
if self.version:
fmt += " -- Deprecated since version {version}."
- return fmt.format(name=wrapped.__name__,
- reason=self.reason or "",
- version=self.version or "")
+ return fmt.format(name=wrapped.__name__, reason=self.reason or "",
version=self.version or "")
def __call__(self, wrapped):
"""
@@ -229,7 +237,7 @@
msg = adapter.get_deprecated_msg(wrapped_, instance_)
with warnings.catch_warnings():
warnings.simplefilter(action, category)
- warnings.warn(msg, category=category, stacklevel=2)
+ warnings.warn(msg, category=category,
stacklevel=_stacklevel)
return wrapped_(*args_, **kwargs_)
return wrapper_function(wrapped)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/deprecated/sphinx.py
new/Deprecated-1.2.7/deprecated/sphinx.py
--- old/Deprecated-1.2.6/deprecated/sphinx.py 2019-02-28 13:44:56.000000000
+0100
+++ new/Deprecated-1.2.7/deprecated/sphinx.py 2019-10-27 16:29:38.000000000
+0100
@@ -82,8 +82,9 @@
:return: the decorated class or function.
"""
reason = textwrap.dedent(self.reason).strip()
- reason = '\n'.join(textwrap.fill(line, width=70, initial_indent=' ',
subsequent_indent=' ')
- for line in reason.splitlines()).strip()
+ reason = '\n'.join(
+ textwrap.fill(line, width=70, initial_indent=' ',
subsequent_indent=' ') for line in reason.splitlines()
+ ).strip()
docstring = textwrap.dedent(wrapped.__doc__ or "")
if docstring:
docstring += "\n\n"
@@ -180,7 +181,4 @@
"""
directive = kwargs.pop('directive', 'deprecated')
adapter_cls = kwargs.pop('adapter_cls', SphinxAdapter)
- return _classic_deprecated(*args,
- directive=directive,
- adapter_cls=adapter_cls,
- **kwargs)
+ return _classic_deprecated(*args, directive=directive,
adapter_cls=adapter_cls, **kwargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/docs/source/conf.py
new/Deprecated-1.2.7/docs/source/conf.py
--- old/Deprecated-1.2.6/docs/source/conf.py 2019-07-06 15:07:23.000000000
+0200
+++ new/Deprecated-1.2.7/docs/source/conf.py 2019-10-27 16:48:22.000000000
+0100
@@ -31,11 +31,13 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
-extensions = ['sphinx.ext.autodoc',
- 'sphinx.ext.doctest',
- 'sphinx.ext.intersphinx',
- 'sphinx.ext.coverage',
- 'sphinx.ext.githubpages']
+extensions = [
+ 'sphinx.ext.autodoc',
+ 'sphinx.ext.doctest',
+ 'sphinx.ext.intersphinx',
+ 'sphinx.ext.coverage',
+ 'sphinx.ext.githubpages',
+]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@@ -59,7 +61,7 @@
# built documents.
#
# The full version, including alpha/beta/rc tags.
-release = "1.2.6"
+release = "1.2.7"
# The short X.Y version.
version = release.rpartition('.')[0]
@@ -143,18 +145,14 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
- (master_doc, 'Deprecated.tex', 'Deprecated Documentation',
- 'Marcos CARDOSO and Laurent LAPORTE', 'manual'),
+ (master_doc, 'Deprecated.tex', 'Deprecated Documentation', 'Marcos CARDOSO
and Laurent LAPORTE', 'manual')
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
-man_pages = [
- (master_doc, 'deprecated', 'Deprecated Documentation',
- [author], 1)
-]
+man_pages = [(master_doc, 'deprecated', 'Deprecated Documentation', [author],
1)]
# -- Options for Texinfo output -------------------------------------------
@@ -162,18 +160,24 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
- (master_doc, 'Deprecated', 'Deprecated Documentation',
- author, 'Deprecated', 'Python @deprecated decorator to deprecate old
python classes, functions or methods.',
- 'Miscellaneous'),
+ (
+ master_doc,
+ 'Deprecated',
+ 'Deprecated Documentation',
+ author,
+ 'Deprecated',
+ 'Python @deprecated decorator to deprecate old python classes,
functions or methods.',
+ 'Miscellaneous',
+ )
]
# Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {'https://docs.python.org/3/': None,
- 'https://wrapt.readthedocs.io/en/latest/': None,
- 'http://flask.pocoo.org/docs/1.0/': None,
- 'django': ('https://docs.djangoproject.com/en/2.1/',
-
'https://docs.djangoproject.com/en/2.1/_objects/'),
- }
+intersphinx_mapping = {
+ 'https://docs.python.org/3/': None,
+ 'https://wrapt.readthedocs.io/en/latest/': None,
+ 'http://flask.pocoo.org/docs/1.0/': None,
+ 'django': ('https://docs.djangoproject.com/en/2.1/',
'https://docs.djangoproject.com/en/2.1/_objects/'),
+}
# -- Options for EPub output -------------------------------------------
@@ -182,9 +186,8 @@
epub_theme_options = {
# relbar1: If this is true, the relbar1 block is inserted in the epub
output, otherwise it is omitted.
'relbar1': False,
-
# footer: If this is true, the footer block is inserted in the epub
output, otherwise it is omitted.
- 'footer': False
+ 'footer': False,
}
epub_title = "Python Deprecated Library v1.2 Documentation"
epub_description = "Python @deprecated decorator to deprecate old python
classes, functions or methods."
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/Deprecated-1.2.6/docs/source/tutorial/v5/sphinx_demo.py
new/Deprecated-1.2.7/docs/source/tutorial/v5/sphinx_demo.py
--- old/Deprecated-1.2.6/docs/source/tutorial/v5/sphinx_demo.py 2019-02-28
13:44:56.000000000 +0100
+++ new/Deprecated-1.2.7/docs/source/tutorial/v5/sphinx_demo.py 2019-10-27
16:32:40.000000000 +0100
@@ -14,15 +14,15 @@
Just guess!
""",
- version='0.3.0')
+ version='0.3.0',
+)
@versionchanged(
reason='Well, I add a new feature in this function. '
- 'It is very useful as you can see in the example below, so try it. '
- 'This is a very very very very very long sentence.',
- version='0.2.0')
-@versionadded(
- reason='Here is my new function.',
- version='0.1.0')
+ 'It is very useful as you can see in the example below, so try it. '
+ 'This is a very very very very very long sentence.',
+ version='0.2.0',
+)
+@versionadded(reason='Here is my new function.', version='0.1.0')
def successor(n):
"""
Calculate the successor of a number.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/setup.py
new/Deprecated-1.2.7/setup.py
--- old/Deprecated-1.2.6/setup.py 2019-07-06 15:08:02.000000000 +0200
+++ new/Deprecated-1.2.7/setup.py 2019-10-27 16:32:40.000000000 +0100
@@ -143,12 +143,13 @@
setup(
name='Deprecated',
- version='1.2.6',
+ version='1.2.7',
url='https://github.com/tantale/deprecated',
project_urls={
"Documentation": "https://deprecated.readthedocs.io/en/latest/",
"Source": "https://github.com/tantale/deprecated",
- "Bug Tracker": "https://github.com/tantale/deprecated/issues"},
+ "Bug Tracker": "https://github.com/tantale/deprecated/issues",
+ },
license='MIT',
author='Laurent LAPORTE', # since v1.1.0
author_email='[email protected]',
@@ -156,9 +157,7 @@
long_description=__doc__,
keywords='deprecate,deprecated,deprecation,warning,warn,decorator',
packages=['deprecated'],
- install_requires=[
- 'wrapt < 2, >= 1.10',
- ],
+ install_requires=['wrapt < 2, >= 1.10'],
zip_safe=False,
include_package_data=True,
platforms='any',
@@ -176,7 +175,7 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
- 'Topic :: Software Development :: Libraries :: Python Modules'
+ 'Topic :: Software Development :: Libraries :: Python Modules',
],
extras_require={
'dev': [
@@ -187,8 +186,7 @@
'PyTest-Cov < 2.6 ; python_version < "3"',
'bumpversion < 1',
'sphinx < 2',
- ],
+ ]
},
-
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/tests/demo_classic_usage.py
new/Deprecated-1.2.7/tests/demo_classic_usage.py
--- old/Deprecated-1.2.6/tests/demo_classic_usage.py 2019-03-28
13:24:18.000000000 +0100
+++ new/Deprecated-1.2.7/tests/demo_classic_usage.py 1970-01-01
01:00:00.000000000 +0100
@@ -1,21 +0,0 @@
-# coding: utf-8
-
-import warnings
-
-
-def foo():
- warnings.warn("Deprecation of foo", DeprecationWarning)
-
-
-def bar():
- warnings.warn("Pending deprecation of foo", PendingDeprecationWarning)
-
-
-def baz():
- warnings.warn("Future deprecation of foo", FutureWarning)
-
-
-if __name__ == '__main__':
- foo() # emit: DeprecationWarning
- bar() # emit nothing
- baz() # emit: FutureWarning
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/tests/demo_classic_usage2.py
new/Deprecated-1.2.7/tests/demo_classic_usage2.py
--- old/Deprecated-1.2.6/tests/demo_classic_usage2.py 2019-03-28
13:25:31.000000000 +0100
+++ new/Deprecated-1.2.7/tests/demo_classic_usage2.py 1970-01-01
01:00:00.000000000 +0100
@@ -1,7 +0,0 @@
-# coding: utf-8
-from demo_classic_usage import foo, bar, baz
-
-if __name__ == '__main__':
- foo() # emit: nothing
- bar() # emit nothing
- baz() # emit: FutureWarning
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/tests/test_deprecated.py
new/Deprecated-1.2.7/tests/test_deprecated.py
--- old/Deprecated-1.2.6/tests/test_deprecated.py 2019-02-28
13:44:56.000000000 +0100
+++ new/Deprecated-1.2.7/tests/test_deprecated.py 2019-11-11
14:45:11.000000000 +0100
@@ -10,19 +10,21 @@
pass
-_PARAMS = [None,
- ((), {}),
- (('Good reason',), {}),
- ((), {'reason': 'Good reason'}),
- ((), {'version': '1.2.3'}),
- ((), {'action': 'once'}),
- ((), {'category': MyDeprecationWarning}),
- ]
+_PARAMS = [
+ None,
+ ((), {}),
+ (('Good reason',), {}),
+ ((), {'reason': 'Good reason'}),
+ ((), {'version': '1.2.3'}),
+ ((), {'action': 'once'}),
+ ((), {'category': MyDeprecationWarning}),
+]
@pytest.fixture(scope="module", params=_PARAMS)
def classic_deprecated_function(request):
if request.param is None:
+
@deprecated.classic.deprecated
def foo1():
pass
@@ -41,6 +43,7 @@
@pytest.fixture(scope="module", params=_PARAMS)
def classic_deprecated_class(request):
if request.param is None:
+
@deprecated.classic.deprecated
class Foo2(object):
pass
@@ -59,6 +62,7 @@
@pytest.fixture(scope="module", params=_PARAMS)
def classic_deprecated_method(request):
if request.param is None:
+
class Foo3(object):
@deprecated.classic.deprecated
def foo3(self):
@@ -79,6 +83,7 @@
@pytest.fixture(scope="module", params=_PARAMS)
def classic_deprecated_static_method(request):
if request.param is None:
+
class Foo4(object):
@staticmethod
@deprecated.classic.deprecated
@@ -101,6 +106,7 @@
@pytest.fixture(scope="module", params=_PARAMS)
def classic_deprecated_class_method(request):
if request.param is None:
+
class Foo5(object):
@classmethod
@deprecated.classic.deprecated
@@ -129,6 +135,7 @@
warn = warns[0]
assert issubclass(warn.category, DeprecationWarning)
assert "deprecated function (or staticmethod)" in str(warn.message)
+ assert warn.filename == __file__, 'Incorrect warning stackLevel'
# noinspection PyShadowingNames
@@ -140,6 +147,7 @@
warn = warns[0]
assert issubclass(warn.category, DeprecationWarning)
assert "deprecated class" in str(warn.message)
+ assert warn.filename == __file__, 'Incorrect warning stackLevel'
# noinspection PyShadowingNames
@@ -152,6 +160,7 @@
warn = warns[0]
assert issubclass(warn.category, DeprecationWarning)
assert "deprecated method" in str(warn.message)
+ assert warn.filename == __file__, 'Incorrect warning stackLevel'
# noinspection PyShadowingNames
@@ -163,6 +172,7 @@
warn = warns[0]
assert issubclass(warn.category, DeprecationWarning)
assert "deprecated function (or staticmethod)" in str(warn.message)
+ assert warn.filename == __file__, 'Incorrect warning stackLevel'
# noinspection PyShadowingNames
@@ -175,6 +185,7 @@
warn = warns[0]
assert issubclass(warn.category, DeprecationWarning)
assert "deprecated function (or staticmethod)" in str(warn.message)
+ assert warn.filename == __file__, 'Incorrect warning stackLevel'
def test_should_raise_type_error():
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/tests/test_deprecated_metaclass.py
new/Deprecated-1.2.7/tests/test_deprecated_metaclass.py
--- old/Deprecated-1.2.6/tests/test_deprecated_metaclass.py 2019-02-28
13:44:56.000000000 +0100
+++ new/Deprecated-1.2.7/tests/test_deprecated_metaclass.py 2019-10-27
16:10:11.000000000 +0100
@@ -11,7 +11,6 @@
# metaclass for one level of class instantiation that replaces itself with
# the actual metaclass.
class metaclass(type):
-
def __new__(cls, name, this_bases, d):
return meta(name, bases, d)
@@ -71,7 +70,6 @@
@deprecated.classic.deprecated
class MyClass(with_metaclass(Meta)):
-
def __init__(self, a, b=5):
self.a = a
self.b = b
@@ -98,7 +96,6 @@
@deprecated.classic.deprecated
class MyClass(with_metaclass(Singleton)):
-
def __init__(self, a, b=5):
self.a = a
self.b = b
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/tests/test_sphinx.py
new/Deprecated-1.2.7/tests/test_sphinx.py
--- old/Deprecated-1.2.6/tests/test_sphinx.py 2019-02-28 13:44:56.000000000
+0100
+++ new/Deprecated-1.2.7/tests/test_sphinx.py 2019-10-27 16:13:42.000000000
+0100
@@ -11,46 +11,64 @@
import deprecated.sphinx
[email protected](scope="module",
- params=[None,
- """This function adds *x* and *y*.""",
- """
- This function adds *x* and *y*.
-
- :param x: number *x*
- :param y: number *y*
- :return: sum = *x* + *y*
- """])
[email protected](
+ scope="module",
+ params=[
+ None,
+ """This function adds *x* and *y*.""",
+ """
+ This function adds *x* and *y*.
+
+ :param x: number *x*
+ :param y: number *y*
+ :return: sum = *x* + *y*
+ """,
+ ],
+)
def docstring(request):
return request.param
[email protected](scope="module",
- params=['versionadded', 'versionchanged', 'deprecated'])
[email protected](scope="module", params=['versionadded', 'versionchanged',
'deprecated'])
def directive(request):
return request.param
# noinspection PyShadowingNames
[email protected]("reason, version, expected", [
- ('A good reason',
- '1.2.0',
- textwrap.dedent("""\
[email protected](
+ "reason, version, expected",
+ [
+ (
+ 'A good reason',
+ '1.2.0',
+ textwrap.dedent(
+ """\
.. {directive}:: {version}
{reason}
- """)),
- (None,
- '1.2.0',
- textwrap.dedent("""\
+ """
+ ),
+ ),
+ (
+ None,
+ '1.2.0',
+ textwrap.dedent(
+ """\
.. {directive}:: {version}
- """)),
- ('A good reason',
- None,
- textwrap.dedent("""\
+ """
+ ),
+ ),
+ (
+ 'A good reason',
+ None,
+ textwrap.dedent(
+ """\
.. {directive}::
{reason}
- """)),
-])
+ """
+ ),
+ ),
+ ],
+)
def test_has_sphinx_docstring(docstring, directive, reason, version, expected):
# The function:
def foo(x, y):
@@ -77,46 +95,62 @@
# noinspection PyShadowingNames
[email protected](sys.version_info < (3, 3),
- reason="Classes should have mutable docstrings -- resolved
in python 3.3")
[email protected]("reason, version, expected", [
- ('A good reason',
- '1.2.0',
- textwrap.dedent("""\
[email protected](
+ sys.version_info < (3, 3), reason="Classes should have mutable docstrings
-- resolved in python 3.3"
+)
[email protected](
+ "reason, version, expected",
+ [
+ (
+ 'A good reason',
+ '1.2.0',
+ textwrap.dedent(
+ """\
.. {directive}:: {version}
{reason}
- """)),
- (None,
- '1.2.0',
- textwrap.dedent("""\
+ """
+ ),
+ ),
+ (
+ None,
+ '1.2.0',
+ textwrap.dedent(
+ """\
.. {directive}:: {version}
- """)),
- ('A good reason',
- None,
- textwrap.dedent("""\
+ """
+ ),
+ ),
+ (
+ 'A good reason',
+ None,
+ textwrap.dedent(
+ """\
.. {directive}::
{reason}
- """)),
-])
+ """
+ ),
+ ),
+ ],
+)
def test_cls_has_sphinx_docstring(docstring, directive, reason, version,
expected):
# The class:
class Foo(object):
pass
-
+
# with docstring:
Foo.__doc__ = docstring
-
+
# is decorated with:
decorator_factory = getattr(deprecated.sphinx, directive)
decorator = decorator_factory(reason=reason, version=version)
Foo = decorator(Foo)
-
+
# The class must contain this Sphinx docstring:
expected = expected.format(directive=directive, version=version,
reason=reason)
-
+
current = textwrap.dedent(Foo.__doc__)
assert current.endswith(expected)
-
+
# An empty line must separate the original docstring and the directive.
current = current.replace(expected, '')
if current:
@@ -127,19 +161,21 @@
pass
-_PARAMS = [None,
- ((), {}),
- (('Good reason',), {}),
- ((), {'reason': 'Good reason'}),
- ((), {'version': '1.2.3'}),
- ((), {'action': 'once'}),
- ((), {'category': MyDeprecationWarning}),
- ]
+_PARAMS = [
+ None,
+ ((), {}),
+ (('Good reason',), {}),
+ ((), {'reason': 'Good reason'}),
+ ((), {'version': '1.2.3'}),
+ ((), {'action': 'once'}),
+ ((), {'category': MyDeprecationWarning}),
+]
@pytest.fixture(scope="module", params=_PARAMS)
def sphinx_deprecated_function(request):
if request.param is None:
+
@deprecated.sphinx.deprecated
def foo1():
pass
@@ -158,6 +194,7 @@
@pytest.fixture(scope="module", params=_PARAMS)
def sphinx_deprecated_class(request):
if request.param is None:
+
@deprecated.sphinx.deprecated
class Foo2(object):
pass
@@ -176,6 +213,7 @@
@pytest.fixture(scope="module", params=_PARAMS)
def sphinx_deprecated_method(request):
if request.param is None:
+
class Foo3(object):
@deprecated.sphinx.deprecated
def foo3(self):
@@ -196,6 +234,7 @@
@pytest.fixture(scope="module", params=_PARAMS)
def sphinx_deprecated_static_method(request):
if request.param is None:
+
class Foo4(object):
@staticmethod
@deprecated.sphinx.deprecated
@@ -218,6 +257,7 @@
@pytest.fixture(scope="module", params=_PARAMS)
def sphinx_deprecated_class_method(request):
if request.param is None:
+
class Foo5(object):
@classmethod
@deprecated.sphinx.deprecated
@@ -249,8 +289,9 @@
# noinspection PyShadowingNames
[email protected](sys.version_info < (3, 3),
- reason="Classes should have mutable docstrings -- resolved
in python 3.3")
[email protected](
+ sys.version_info < (3, 3), reason="Classes should have mutable docstrings
-- resolved in python 3.3"
+)
def test_sphinx_deprecated_class__warns(sphinx_deprecated_class):
with warnings.catch_warnings(record=True) as warns:
warnings.simplefilter("always")
@@ -355,4 +396,4 @@
with warnings.catch_warnings(record=True) as warns:
warnings.simplefilter("always")
warnings.warn("A message in a bottle", category=DeprecationWarning,
stacklevel=2)
- assert len(warns) == 1
\ No newline at end of file
+ assert len(warns) == 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/tests/test_sphinx_class.py
new/Deprecated-1.2.7/tests/test_sphinx_class.py
--- old/Deprecated-1.2.6/tests/test_sphinx_class.py 2019-02-28
13:44:56.000000000 +0100
+++ new/Deprecated-1.2.7/tests/test_sphinx_class.py 2019-10-27
16:35:43.000000000 +0100
@@ -41,8 +41,9 @@
assert stream.getvalue().strip() == u"I am deprecated!"
[email protected](sys.version_info < (3, 3),
- reason="Classes should have mutable docstrings -- resolved
in python 3.3")
[email protected](
+ sys.version_info < (3, 3), reason="Classes should have mutable docstrings
-- resolved in python 3.3"
+)
def test_class_deprecation_using_deprecated_decorator():
@deprecated.sphinx.deprecated
class MyBaseClass(object):
@@ -61,8 +62,9 @@
assert issubclass(MySubClass, MyBaseClass)
[email protected](sys.version_info < (3, 3),
- reason="Classes should have mutable docstrings -- resolved
in python 3.3")
[email protected](
+ sys.version_info < (3, 3), reason="Classes should have mutable docstrings
-- resolved in python 3.3"
+)
def test_subclass_deprecation_using_deprecated_decorator():
@deprecated.sphinx.deprecated
class MyBaseClass(object):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/tests/test_sphinx_metaclass.py
new/Deprecated-1.2.7/tests/test_sphinx_metaclass.py
--- old/Deprecated-1.2.6/tests/test_sphinx_metaclass.py 2019-02-28
13:44:56.000000000 +0100
+++ new/Deprecated-1.2.7/tests/test_sphinx_metaclass.py 2019-10-27
16:10:11.000000000 +0100
@@ -11,7 +11,6 @@
# metaclass for one level of class instantiation that replaces itself with
# the actual metaclass.
class metaclass(type):
-
def __new__(cls, name, this_bases, d):
return meta(name, bases, d)
@@ -71,7 +70,6 @@
@deprecated.classic.deprecated
class MyClass(with_metaclass(Meta)):
-
def __init__(self, a, b=5):
self.a = a
self.b = b
@@ -98,7 +96,6 @@
@deprecated.classic.deprecated
class MyClass(with_metaclass(Singleton)):
-
def __init__(self, a, b=5):
self.a = a
self.b = b
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Deprecated-1.2.6/tox.ini new/Deprecated-1.2.7/tox.ini
--- old/Deprecated-1.2.6/tox.ini 2019-07-06 20:58:20.000000000 +0200
+++ new/Deprecated-1.2.7/tox.ini 2019-11-11 14:45:11.000000000 +0100
@@ -9,7 +9,7 @@
[tox]
# py32 not supported by tox and pytest
envlist =
- py{27,34,35,36,37}-wrapt{1.10,1.11}
+ py{27,34,35,36,37,38}-wrapt{1.10,1.11}
pypy
docs
@@ -18,9 +18,9 @@
deps =
py27,py34,py35: pip >= 9.0.3, < 19.2
py27,py34: PyTest < 5
- py35,py36,py37,pypy: PyTest
+ py35,py36,py37,py38,pypy: PyTest
py27,py34: PyTest-Cov < 2.6
- py35,py36,py37,pypy: PyTest-Cov
+ py35,py36,py37,py38,pypy: PyTest-Cov
wrapt1.10: wrapt ~= 1.10.0
wrapt1.11: wrapt ~= 1.11.0