Hello community, here is the log from the commit of package python-ddt for openSUSE:Factory checked in at 2017-08-24 18:45:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-ddt (Old) and /work/SRC/openSUSE:Factory/.python-ddt.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-ddt" Thu Aug 24 18:45:02 2017 rev:4 rq:514463 version:1.1.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-ddt/python-ddt.changes 2016-09-01 14:03:45.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-ddt.new/python-ddt.changes 2017-08-24 18:45:53.200437420 +0200 @@ -1,0 +2,9 @@ +Wed Aug 2 10:16:07 UTC 2017 - [email protected] + +- update to 1.1.1 + * Add `@idata(iterable)` decorator-function. (#40) + * Set __wrapped__ for Python 2 (#45) + * Include more files in generated tarballs (#43) +- convert to singlespec + +------------------------------------------------------------------- Old: ---- ddt-1.1.0.tar.gz New: ---- ddt-1.1.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-ddt.spec ++++++ --- /var/tmp/diff_new_pack.5pp83Z/_old 2017-08-24 18:45:54.040319163 +0200 +++ /var/tmp/diff_new_pack.5pp83Z/_new 2017-08-24 18:45:54.064315784 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-ddt # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 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 @@ -16,40 +16,45 @@ # +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +%bcond_without test Name: python-ddt -Version: 1.1.0 +Version: 1.1.1 Release: 0 Summary: Data-Driven/Decorated Tests License: MIT Group: Development/Languages/Python Url: https://github.com/txels/ddt -Source: https://pypi.io/packages/source/d/ddt/ddt-%{version}.tar.gz -BuildRequires: python-devel -BuildRequires: python-setuptools -BuildRoot: %{_tmppath}/%{name}-%{version}-build -%if 0%{?suse_version} && 0%{?suse_version} <= 1110 -%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%else -BuildArch: noarch -%endif +Source: https://files.pythonhosted.org/packages/source/d/ddt/ddt-%{version}.tar.gz +BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} +BuildRequires: python-rpm-macros +# SECTION test requirements +BuildRequires: %{python_module PyYAML} +BuildRequires: %{python_module mock} +BuildRequires: %{python_module nose} +# /SECTION + +%python_subpackages %description -A library to multiply test cases +A library to multiply test cases. %prep %setup -q -n ddt-%{version} %build -python setup.py build +%{python_build} %install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} +%{python_install} %check -python setup.py test +%{python_exec setup.py test} -%files +%files %{python_files} %defattr(-,root,root,-) %{python_sitelib}/* +%doc *.md %changelog ++++++ ddt-1.1.0.tar.gz -> ddt-1.1.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.1.0/2.0.md new/ddt-1.1.1/2.0.md --- old/ddt-1.1.0/2.0.md 1970-01-01 01:00:00.000000000 +0100 +++ new/ddt-1.1.1/2.0.md 2016-08-03 23:43:45.000000000 +0200 @@ -0,0 +1,42 @@ +Hi all, thanks for using the library, your contributions, and especially for not bitching about me not being very responsive. + +I have been giving the future of `ddt` some thought over the past weeks. + +To give some background about how `ddt` came to be: I was looking for something that gave to unit tests a similar power as to what one could do with nosetests generators (which only worked for nose function-based tests): the ability to run a test case multiple times with different data. At that time I was beginning to learn me some more advanced Python (I had only been using the language for a few months) and was exploring the various mechanisms for metaprogramming available in the language. I was fascinated that one could add methods to a class at runtime, and I wrote this then tiny library that did that. + +Over time I've been taking some people's contributions, some of which grew the feature set into areas I hadn't even considered (like reading data from files) - but in honesty, that tiny initial feature has been enough for me and is about the only one I've actually personally used from the library. + +This has unfortunately meant that I've not always been paying as much attention as I should have to backwards compatibility of certain features (which made some people not particularly happy) or simplifying extensibility in general. + +Back from that digression, I've often thought that I wanted `ddt` to go back to its simpler origins, but still be easily applicable to other people's more complex use cases. One of the design decisions I've come to regret the most about `ddt` has been using `*args` as the mechanism to pass test data to the test methods, because that limits the potential for the API to grow quite a bit. + +My current thinking of what the new ddt should look like is: + +- keep the class decorator `ddt` +- a single method decorator that takes test data as an iterable (e.g. similar to the one proposed in https://github.com/txels/ddt/pull/40), and options as keyword arguments. A well defined mechanism would tell ddt how to generate suffixes for the test cases from the test data. +- get rid of all the other decorators for unpacking, reading from file etc. + - the unpacking options would become keyword arguments to the main decorator (e.g. `unpack`, `unpack_dict` or similar...) + - the methods to read from file etc would be just methods that read from a file and return some iterable over the data + +E.g. assuming we call the new decorator `idata`, it would look like: + +``` +@idata(test_data, **options) +def test_something(self, value): +``` + +E.g. in a practical use: + +``` +@idata(from_file('something.yml'), unpack=TUPLE) +def test_something(self, x, y, z): +``` + +``` +@idata(some_dict, unpack=DICT) +def test_something_else(self, x, y, result): +``` + + + +Requested features like cartesian products or even additional boundary test data generation could easily be added as just plain functions with whatever arguments that return an iterable. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.1.0/CONTRIBUTING.md new/ddt-1.1.1/CONTRIBUTING.md --- old/ddt-1.1.0/CONTRIBUTING.md 1970-01-01 01:00:00.000000000 +0100 +++ new/ddt-1.1.1/CONTRIBUTING.md 2015-01-27 19:38:50.000000000 +0100 @@ -0,0 +1,34 @@ +# Contributing to DDT + +We'll be happy if you want to contribute to the improvement of `ddt`. + +Code contributions will take the form of pull requests to +[the github repo](https://github.com/txels/ddt). + +Your PRs are more likely to be merged quickly if: + + - They adhere to coding conventions in the repo (PEP8) + - They include tests + +## Building + +PRs to `ddt` are always built by Travis-CI on Python 2 and 3. + +If you want to build `ddt` locally, the simplest way is to use `tox`: + +``` +pip install tox +tox +``` + +This will run tests on various releases of python (2 and 3, as long as they +are installed in your computer), run `flake8` and build the Sphinx +documentation. + +Alternatively, if you only want to run tests on your active version of python, +I recommend you make yourself a virtual environment and: + +``` +pip install -r requirements/build.txt +./build.sh +``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.1.0/LICENSE.md new/ddt-1.1.1/LICENSE.md --- old/ddt-1.1.0/LICENSE.md 1970-01-01 01:00:00.000000000 +0100 +++ new/ddt-1.1.1/LICENSE.md 2015-01-27 19:39:09.000000000 +0100 @@ -0,0 +1,21 @@ +Copyright © 2015 Carles Barrobés and additional contributors. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +([MIT License](http://mit-license.org/)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.1.0/MANIFEST.in new/ddt-1.1.1/MANIFEST.in --- old/ddt-1.1.0/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100 +++ new/ddt-1.1.1/MANIFEST.in 2016-10-07 21:12:44.000000000 +0200 @@ -0,0 +1,2 @@ +include *.md +recursive-include test *.py *.json *.yaml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.1.0/PKG-INFO new/ddt-1.1.1/PKG-INFO --- old/ddt-1.1.0/PKG-INFO 2016-05-31 09:27:22.000000000 +0200 +++ new/ddt-1.1.1/PKG-INFO 2016-10-07 21:28:35.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: ddt -Version: 1.1.0 +Version: 1.1.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.1.0/README.md new/ddt-1.1.1/README.md --- old/ddt-1.1.0/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/ddt-1.1.1/README.md 2016-05-20 09:33:32.000000000 +0200 @@ -0,0 +1,20 @@ +[](https://travis-ci.org/txels/ddt) +[](https://landscape.io/github/txels/ddt/master) +<!-- [](https://caniusepython3.com/project/ddt) --> +[](https://codecov.io/github/txels/ddt) +[](https://pypi.python.org/pypi/ddt) +[](https://pypi.python.org/pypi/ddt) + +DDT (Data-Driven Tests) allows you to multiply one test case +by running it with different test data, and make it appear as +multiple test cases. + +Installation +------------ + +```pip install ddt``` + +More info at http://ddt.readthedocs.org/ + +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.1.0/ddt.egg-info/PKG-INFO new/ddt-1.1.1/ddt.egg-info/PKG-INFO --- old/ddt-1.1.0/ddt.egg-info/PKG-INFO 2016-05-31 09:27:21.000000000 +0200 +++ new/ddt-1.1.1/ddt.egg-info/PKG-INFO 2016-10-07 21:28:34.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: ddt -Version: 1.1.0 +Version: 1.1.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.1.0/ddt.egg-info/SOURCES.txt new/ddt-1.1.1/ddt.egg-info/SOURCES.txt --- old/ddt-1.1.0/ddt.egg-info/SOURCES.txt 2016-05-31 09:27:22.000000000 +0200 +++ new/ddt-1.1.1/ddt.egg-info/SOURCES.txt 2016-10-07 21:28:35.000000000 +0200 @@ -1,9 +1,23 @@ +2.0.md +CONTRIBUTING.md +LICENSE.md +MANIFEST.in +README.md ddt.py +pr40.md setup.cfg setup.py ddt.egg-info/PKG-INFO ddt.egg-info/SOURCES.txt ddt.egg-info/dependency_links.txt ddt.egg-info/top_level.txt +test/__init__.py +test/mycode.py +test/test_data_dict.json +test/test_data_dict.yaml +test/test_data_dict_dict.json +test/test_data_dict_dict.yaml +test/test_data_list.json +test/test_data_list.yaml test/test_example.py test/test_functional.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.1.0/ddt.py new/ddt-1.1.1/ddt.py --- old/ddt-1.1.0/ddt.py 2016-05-31 09:26:35.000000000 +0200 +++ new/ddt-1.1.1/ddt.py 2016-10-07 21:13:28.000000000 +0200 @@ -18,7 +18,7 @@ else: _have_yaml = True -__version__ = '1.1.0' +__version__ = '1.1.1' # These attributes will not conflict with any real python attribute # They are added to the decorated test method and processed later @@ -59,8 +59,18 @@ Should be added to methods of instances of ``unittest.TestCase``. """ + return idata(values) + + +def idata(iterable): + """ + Method decorator to add to your test methods. + + Should be added to methods of instances of ``unittest.TestCase``. + + """ def wrapper(func): - setattr(func, DATA_ATTR, values) + setattr(func, DATA_ATTR, iterable) return func return wrapper @@ -128,6 +138,7 @@ def wrapper(self): return func(self, *args, **kwargs) wrapper.__name__ = new_name + wrapper.__wrapped__ = func # Try to call format on the docstring if func.__doc__: try: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.1.0/pr40.md new/ddt-1.1.1/pr40.md --- old/ddt-1.1.0/pr40.md 1970-01-01 01:00:00.000000000 +0100 +++ new/ddt-1.1.1/pr40.md 2016-08-03 17:48:15.000000000 +0200 @@ -0,0 +1,3 @@ +BTW in terms of memory efficiency: since `ddt` is not (nor wants to be) a test runner, in order for the test runner to work properly it has to make the class look like it has one different test method per data value - these extra methods are created dynamically at class load time, not at test execution time. Meaning that the whole generator data will have to be materialised in memory anyway, hence there will not be the typical memory savings of other scenarios where generators are used. + +If you need to test with large datasets, `ddt` is not going to be a memory efficient approach. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.1.0/test/mycode.py new/ddt-1.1.1/test/mycode.py --- old/ddt-1.1.0/test/mycode.py 1970-01-01 01:00:00.000000000 +0100 +++ new/ddt-1.1.1/test/mycode.py 2014-09-26 13:22:56.000000000 +0200 @@ -0,0 +1,15 @@ +""" +Some simple functions that we will use in our tests. +""" + + +def larger_than_two(value): + return value > 2 + + +def has_three_elements(value): + return len(value) == 3 + + +def is_a_greeting(value): + return value in ['Hello', 'Goodbye'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.1.0/test/test_data_dict.json new/ddt-1.1.1/test/test_data_dict.json --- old/ddt-1.1.0/test/test_data_dict.json 1970-01-01 01:00:00.000000000 +0100 +++ new/ddt-1.1.1/test/test_data_dict.json 2014-09-26 13:22:56.000000000 +0200 @@ -0,0 +1,4 @@ +{ + "unsorted_list": [ 10, 12, 15 ], + "sorted_list": [ 15, 12, 50 ] +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.1.0/test/test_data_dict.yaml new/ddt-1.1.1/test/test_data_dict.yaml --- old/ddt-1.1.0/test/test_data_dict.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/ddt-1.1.1/test/test_data_dict.yaml 2016-05-31 09:26:09.000000000 +0200 @@ -0,0 +1,6 @@ +unsorted_list: + - 10 + - 15 + - 12 + +sorted_list: [ 15, 12, 50 ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.1.0/test/test_data_dict_dict.json new/ddt-1.1.1/test/test_data_dict_dict.json --- old/ddt-1.1.0/test/test_data_dict_dict.json 1970-01-01 01:00:00.000000000 +0100 +++ new/ddt-1.1.1/test/test_data_dict_dict.json 2015-10-26 18:01:56.000000000 +0100 @@ -0,0 +1,22 @@ +{ + "positive_integer_range": { + "start": 0, + "end": 2, + "value": 1 + }, + "negative_integer_range": { + "start": -2, + "end": 0, + "value": -1 + }, + "positive_real_range": { + "start": 0.0, + "end": 1.0, + "value": 0.5 + }, + "negative_real_range": { + "start": -1.0, + "end": 0.0, + "value": -0.5 + } +} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.1.0/test/test_data_dict_dict.yaml new/ddt-1.1.1/test/test_data_dict_dict.yaml --- old/ddt-1.1.0/test/test_data_dict_dict.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/ddt-1.1.1/test/test_data_dict_dict.yaml 2016-05-31 09:26:09.000000000 +0200 @@ -0,0 +1,19 @@ +positive_integer_range: + start: 0 + end: 2 + value: 1 + +negative_integer_range: + start: -2 + end: 0 + value: -1 + +positive_real_range: + start: 0.0 + end: 1.0 + value: 0.5 + +negative_real_range: + start: -1.0 + end: 0.0 + value: -0.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.1.0/test/test_data_list.json new/ddt-1.1.1/test/test_data_list.json --- old/ddt-1.1.0/test/test_data_list.json 1970-01-01 01:00:00.000000000 +0100 +++ new/ddt-1.1.1/test/test_data_list.json 2014-09-26 13:22:56.000000000 +0200 @@ -0,0 +1,5 @@ +[ + "Hello", + "Goodbye" +] + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ddt-1.1.0/test/test_data_list.yaml new/ddt-1.1.1/test/test_data_list.yaml --- old/ddt-1.1.0/test/test_data_list.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/ddt-1.1.1/test/test_data_list.yaml 2016-05-31 09:26:09.000000000 +0200 @@ -0,0 +1,2 @@ +- "Hello" +- "Goodbye"
