Hello community, here is the log from the commit of package python-ddt for openSUSE:Factory checked in at 2019-03-12 09:44:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-ddt (Old) and /work/SRC/openSUSE:Factory/.python-ddt.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-ddt" Tue Mar 12 09:44:48 2019 rev:7 rq:682478 version:1.2.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-ddt/python-ddt.changes 2018-12-06 12:14:36.509694408 +0100 +++ /work/SRC/openSUSE:Factory/.python-ddt.new.28833/python-ddt.changes 2019-03-12 09:44:49.467757747 +0100 @@ -1,0 +2,6 @@ +Thu Mar 7 14:07:30 UTC 2019 - Tomáš Chvátal <[email protected]> + +- Update to 1.2.1: + * Merge pull request #68 from datadriventests/fix-docstring-behavior + +------------------------------------------------------------------- Old: ---- ddt-1.2.0.tar.gz New: ---- ddt-1.2.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-ddt.spec ++++++ --- /var/tmp/diff_new_pack.2lW5Ah/_old 2019-03-12 09:44:50.003756244 +0100 +++ /var/tmp/diff_new_pack.2lW5Ah/_new 2019-03-12 09:44:50.003756244 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-ddt # -# 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 @@ -18,23 +18,22 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-ddt -Version: 1.2.0 +Version: 1.2.1 Release: 0 Summary: Data-Driven/Decorated Tests License: MIT Group: Development/Languages/Python -Url: https://github.com/txels/ddt +URL: https://github.com/txels/ddt Source: https://files.pythonhosted.org/packages/source/d/ddt/ddt-%{version}.tar.gz BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros +BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module PyYAML} BuildRequires: %{python_module mock} BuildRequires: %{python_module nose} # /SECTION -BuildArch: noarch - %python_subpackages %description @@ -44,10 +43,10 @@ %setup -q -n ddt-%{version} %build -%{python_build} +%python_build %install -%{python_install} +%python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check ++++++ ddt-1.2.0.tar.gz -> ddt-1.2.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.2.0/PKG-INFO new/ddt-1.2.1/PKG-INFO --- old/ddt-1.2.0/PKG-INFO 2018-07-17 22:52:34.000000000 +0200 +++ new/ddt-1.2.1/PKG-INFO 2019-02-24 08:17:50.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: ddt -Version: 1.2.0 +Version: 1.2.1 Summary: Data-Driven/Decorated Tests Home-page: https://github.com/txels/ddt Author: Carles Barrobés diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.2.0/README.md new/ddt-1.2.1/README.md --- old/ddt-1.2.0/README.md 2018-05-13 15:48:37.000000000 +0200 +++ new/ddt-1.2.1/README.md 2019-02-24 05:12:08.000000000 +0100 @@ -1,7 +1,7 @@ [](https://travis-ci.org/txels/ddt) [](https://landscape.io/github/txels/ddt/master) -<!-- [](https://caniusepython3.com/project/ddt) --> [](https://codecov.io/github/txels/ddt) +<br /> [](https://pypi.python.org/pypi/ddt) [](https://pypi.python.org/pypi/ddt) @@ -14,7 +14,7 @@ ```pip install ddt``` -More info at http://ddt.readthedocs.org/ +Check out [the documentation](http://ddt.readthedocs.org/) for more details. See [Contributing](CONTRIBUTING.md) if you plan to contribute to `ddt`, and [License](LICENSE.md) if you plan to use it. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.2.0/ddt.egg-info/PKG-INFO new/ddt-1.2.1/ddt.egg-info/PKG-INFO --- old/ddt-1.2.0/ddt.egg-info/PKG-INFO 2018-07-17 22:52:34.000000000 +0200 +++ new/ddt-1.2.1/ddt.egg-info/PKG-INFO 2019-02-24 08:17:50.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: ddt -Version: 1.2.0 +Version: 1.2.1 Summary: Data-Driven/Decorated Tests Home-page: https://github.com/txels/ddt Author: Carles Barrobés diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.2.0/ddt.py new/ddt-1.2.1/ddt.py --- old/ddt-1.2.0/ddt.py 2018-07-17 22:42:05.000000000 +0200 +++ new/ddt-1.2.1/ddt.py 2019-02-24 08:10:28.000000000 +0100 @@ -19,7 +19,7 @@ else: _have_yaml = True -__version__ = '1.2.0' +__version__ = '1.2.1' # These attributes will not conflict with any real python attribute # They are added to the decorated test method and processed later @@ -135,7 +135,7 @@ return re.sub(r'\W|^(?=\d)', '_', test_name) -def feed_data(func, new_name, test_docstring, *args, **kwargs): +def feed_data(func, new_name, test_data_docstring, *args, **kwargs): """ This internal method decorator feeds the test data item to the test. @@ -146,8 +146,8 @@ wrapper.__name__ = new_name wrapper.__wrapped__ = func # set docstring if exists - if test_docstring is not None: - wrapper.__doc__ = test_docstring + if test_data_docstring is not None: + wrapper.__doc__ = test_data_docstring else: # Try to call format on the docstring if func.__doc__: @@ -177,7 +177,6 @@ def process_file_data(cls, name, func, file_attr): """ Process the parameter in the `file_data` decorator. - """ cls_path = os.path.abspath(inspect.getsourcefile(cls)) data_file_path = os.path.join(os.path.dirname(cls_path), file_attr) @@ -223,7 +222,6 @@ def _add_tests_from_data(cls, name, func, data): """ Add tests from data loaded from the data file into the class - """ for i, elem in enumerate(data): if isinstance(data, dict): @@ -238,6 +236,23 @@ add_test(cls, test_name, test_name, func, value) +def _is_primitive(obj): + """Finds out if the obj is a "primitive". It is somewhat hacky but it works. + """ + return not hasattr(obj, '__dict__') + + +def _get_test_data_docstring(func, value): + """Returns a docstring based on the following resolution strategy: + 1. Passed value is not a "primitive" and has a docstring, then use it. + 2. In all other cases return None, i.e the test name is used. + """ + if not _is_primitive(value) and value.__doc__: + return value.__doc__ + else: + return None + + def ddt(cls): """ Class decorator for subclasses of ``unittest.TestCase``. @@ -266,15 +281,27 @@ if hasattr(func, DATA_ATTR): for i, v in enumerate(getattr(func, DATA_ATTR)): test_name = mk_test_name(name, getattr(v, "__name__", v), i) - test_docstring = getattr(v, "__doc__", None) + test_data_docstring = _get_test_data_docstring(func, v) if hasattr(func, UNPACK_ATTR): if isinstance(v, tuple) or isinstance(v, list): - add_test(cls, test_name, test_docstring, func, *v) + add_test( + cls, + test_name, + test_data_docstring, + func, + *v + ) else: # unpack dictionary - add_test(cls, test_name, test_docstring, func, **v) + add_test( + cls, + test_name, + test_data_docstring, + func, + **v + ) else: - add_test(cls, test_name, test_docstring, func, v) + add_test(cls, test_name, test_data_docstring, func, v) delattr(cls, name) elif hasattr(func, FILE_ATTR): file_attr = getattr(func, FILE_ATTR) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.2.0/test/test_functional.py new/ddt-1.2.1/test/test_functional.py --- old/ddt-1.2.0/test/test_functional.py 2018-07-17 22:32:10.000000000 +0200 +++ new/ddt-1.2.1/test/test_functional.py 2019-02-24 08:10:28.000000000 +0100 @@ -242,7 +242,7 @@ Test the ``__doc__`` attribute handling of ``data`` items with ``ddt`` """ - def hello(): + def func_w_doc(): """testFunctionDocstring {6} :param: None @@ -250,6 +250,9 @@ """ pass + def func_wo_doc(): + pass + class Myint(int): pass @@ -263,18 +266,40 @@ d2 = Myint(2) d2.__name__ = 'case2' - data_hello = data(d1, d2)(hello) - setattr(Mytest, 'test_hello', data_hello) + data_hello = data(d1, d2, {'test': True})(func_w_doc) + data_hello2 = data(d1, d2, {'test': True})(func_wo_doc) + + setattr(Mytest, 'first_test', data_hello) + setattr(Mytest, 'second_test', data_hello2) ddt_mytest = ddt(Mytest) assert_equal( getattr( - getattr(ddt_mytest, 'test_hello_1_case1'), '__doc__'), d1.__doc__ + getattr(ddt_mytest, 'first_test_1_case1'), '__doc__'), d1.__doc__ + ) + assert_equal( + getattr( + getattr(ddt_mytest, 'first_test_2_case2'), '__doc__'), + func_w_doc.__doc__ + ) + assert_equal( + getattr( + getattr(ddt_mytest, 'first_test_3'), '__doc__'), + func_w_doc.__doc__ ) assert_equal( getattr( - getattr(ddt_mytest, 'test_hello_2_case2'), '__doc__'), - hello.__doc__ + getattr(ddt_mytest, 'second_test_1_case1'), '__doc__'), d1.__doc__ + ) + assert_equal( + getattr( + getattr(ddt_mytest, 'second_test_2_case2'), '__doc__'), + None + ) + assert_equal( + getattr( + getattr(ddt_mytest, 'second_test_3'), '__doc__'), + None ) @@ -282,10 +307,6 @@ """ Test that unicode strings are converted to function names correctly """ - - def hello(): - pass - # We test unicode support separately for python 2 and 3 if six.PY2:
