Hello community,
here is the log from the commit of package python-parameterized for
openSUSE:Factory checked in at 2019-12-11 12:09:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-parameterized (Old)
and /work/SRC/openSUSE:Factory/.python-parameterized.new.4691 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-parameterized"
Wed Dec 11 12:09:42 2019 rev:6 rq:754448 version:0.7.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-parameterized/python-parameterized.changes
2019-11-22 10:19:24.089361309 +0100
+++
/work/SRC/openSUSE:Factory/.python-parameterized.new.4691/python-parameterized.changes
2019-12-11 12:11:00.036592066 +0100
@@ -1,0 +2,8 @@
+Thu Dec 5 15:52:40 CET 2019 - Matej Cepl <[email protected]>
+
+- Update to 0.7.1:
+ - calling `setUp` and `tearDown` in parameterized classesq
+- Add skip_Documentation_tests.patch to skip over test cases,
+ failing with Python 3.8. gh#wolever/parameterized#84
+
+-------------------------------------------------------------------
Old:
----
parameterized-0.7.0.tar.gz
New:
----
parameterized-0.7.1.tar.gz
skip_Documentation_tests.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-parameterized.spec ++++++
--- /var/tmp/diff_new_pack.Sex3FU/_old 2019-12-11 12:11:06.692589267 +0100
+++ /var/tmp/diff_new_pack.Sex3FU/_new 2019-12-11 12:11:06.692589267 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-parameterized
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,24 +18,26 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-parameterized
-Version: 0.7.0
+Version: 0.7.1
Release: 0
Summary: Parameterized testing
License: BSD-2-Clause
-Url: https://github.com/wolever/parameterized
+URL: https://github.com/wolever/parameterized
Source:
https://files.pythonhosted.org/packages/source/p/parameterized/parameterized-%{version}.tar.gz
+# PATCH-FIX-UPSTREAM skip_Documentation_tests.patch
gh#wolever/parameterized#84 [email protected]
+# Skip tests failing with Python 3.8
+Patch0: skip_Documentation_tests.patch
BuildRequires: %{python_module mock}
BuildRequires: %{python_module nose2}
BuildRequires: %{python_module nose}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module unittest2}
+BuildRequires: fdupes
+BuildRequires: python-rpm-macros
Suggests: python-nose
Suggests: python-nose2
Suggests: python-unittest2
-BuildRequires: fdupes
-BuildRequires: python-rpm-macros
BuildArch: noarch
-
%python_subpackages
%description
@@ -45,6 +47,7 @@
%prep
%setup -q -n parameterized-%{version}
+%autopatch -p1
%build
%python_build
@@ -55,6 +58,7 @@
%check
export LANG=en_US.UTF8
+# gh#wolever/parameterized#84
%{python_expand nosetests-%$python_version}
%{python_expand nose2-%$python_version}
%{python_expand unit2-%$python_version}
++++++ parameterized-0.7.0.tar.gz -> parameterized-0.7.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/parameterized-0.7.0/.travis.yml
new/parameterized-0.7.1/.travis.yml
--- old/parameterized-0.7.0/.travis.yml 2018-12-31 06:10:25.000000000 +0100
+++ new/parameterized-0.7.1/.travis.yml 2019-11-19 22:04:40.000000000 +0100
@@ -1,3 +1,6 @@
+# !!! WARNING !!!
+# This file is automatically generated by ./rebuild-travis-yaml
+# !!! WARNING !!!
language: python
sudo: false
matrix:
@@ -6,7 +9,9 @@
python: "2.7"
- env: "TOXENV=py27-nose2"
python: "2.7"
- - env: "TOXENV=py27-pytest"
+ - env: "TOXENV=py27-pytest2"
+ python: "2.7"
+ - env: "TOXENV=py27-pytest3"
python: "2.7"
- env: "TOXENV=py27-unit"
python: "2.7"
@@ -16,7 +21,9 @@
python: "3.5"
- env: "TOXENV=py35-nose2"
python: "3.5"
- - env: "TOXENV=py35-pytest"
+ - env: "TOXENV=py35-pytest2"
+ python: "3.5"
+ - env: "TOXENV=py35-pytest3"
python: "3.5"
- env: "TOXENV=py35-unit"
python: "3.5"
@@ -26,7 +33,9 @@
python: "3.6"
- env: "TOXENV=py36-nose2"
python: "3.6"
- - env: "TOXENV=py36-pytest"
+ - env: "TOXENV=py36-pytest2"
+ python: "3.6"
+ - env: "TOXENV=py36-pytest3"
python: "3.6"
- env: "TOXENV=py36-unit"
python: "3.6"
@@ -36,11 +45,27 @@
python: "pypy"
- env: "TOXENV=pypy-nose2"
python: "pypy"
- - env: "TOXENV=pypy-pytest"
+ - env: "TOXENV=pypy-pytest2"
+ python: "pypy"
+ - env: "TOXENV=pypy-pytest3"
python: "pypy"
- env: "TOXENV=pypy-unit"
python: "pypy"
- env: "TOXENV=pypy-unit2"
python: "pypy"
+ - env: "TOXENV=py37-nose"
+ python: "3.7"
+ - env: "TOXENV=py37-nose2"
+ python: "3.7"
+ - env: "TOXENV=py37-pytest3"
+ python: "3.7"
+ - env: "TOXENV=py37-unit"
+ python: "3.7"
+ - env: "TOXENV=py37-unit2"
+ python: "3.7"
+
install: pip install tox
script: tox
+# !!! WARNING !!!
+# This file is automatically generated by ./rebuild-travis-yaml
+# !!! WARNING !!!
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/parameterized-0.7.0/CHANGELOG.txt
new/parameterized-0.7.1/CHANGELOG.txt
--- old/parameterized-0.7.0/CHANGELOG.txt 2019-02-06 04:43:03.000000000
+0100
+++ new/parameterized-0.7.1/CHANGELOG.txt 2019-11-19 23:04:03.000000000
+0100
@@ -1,3 +1,6 @@
+0.7.1 (2019-11-19)
+ * Fix #73: calling `setUp` and `tearDown` in parameterized classes
+
0.7.0 (2019-02-05)
* Added parameterized_class feature, for parameterizing entire test
classes (many thanks to @TobyLL for their suggestions and help testing!)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/parameterized-0.7.0/LICENSE.txt
new/parameterized-0.7.1/LICENSE.txt
--- old/parameterized-0.7.0/LICENSE.txt 2019-02-06 04:41:38.000000000 +0100
+++ new/parameterized-0.7.1/LICENSE.txt 2019-11-19 21:17:12.000000000 +0100
@@ -13,10 +13,10 @@
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
-THIS SOFTWARE IS PROVIDED BY <COPYRIGHT HOLDER> ``AS IS'' AND ANY EXPRESS OR
+THIS SOFTWARE IS PROVIDED BY DAVID WOLEVER ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-EVENT SHALL <COPYRIGHT HOLDER> OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+EVENT SHALL DAVID WOLEVER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/parameterized-0.7.0/PKG-INFO
new/parameterized-0.7.1/PKG-INFO
--- old/parameterized-0.7.0/PKG-INFO 2019-02-06 04:43:34.000000000 +0100
+++ new/parameterized-0.7.1/PKG-INFO 2019-11-19 23:04:22.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: parameterized
-Version: 0.7.0
+Version: 0.7.1
Summary: Parameterized testing with any Python test framework
Home-page: https://github.com/wolever/parameterized
Author: David Wolever
@@ -9,7 +9,14 @@
Description: Parameterized testing with any Python test framework
====================================================
- .. image::
https://travis-ci.org/wolever/parameterized.svg?branch=master
+ |pypi| |travis|
+
+ .. |pypi| image:: https://img.shields.io/pypi/v/parameterized.svg
+ :alt: PyPI
+ :target: https://pypi.org/project/parameterized/
+
+ .. |travis| image::
https://travis-ci.org/wolever/parameterized.svg?branch=master
+ :alt: Travis CI
:target: https://travis-ci.org/wolever/parameterized
Parameterized testing in Python sucks.
@@ -175,7 +182,7 @@
Compatibility
-------------
- `Yes`__.
+ `Yes`__ (mostly).
__ https://travis-ci.org/wolever/parameterized
@@ -191,6 +198,7 @@
- Py3.6
- Py3.7
- PyPy
+ - ``@mock.patch``
* - nose
- yes
- yes
@@ -199,6 +207,7 @@
- yes
- yes
- yes
+ - yes
* - nose2
- yes
- yes
@@ -207,14 +216,43 @@
- yes
- yes
- yes
- * - py.test
+ - yes
+ * - py.test 2
+ - yes
+ - yes
+ - no*
+ - no*
+ - no*
+ - no*
- yes
- yes
+ * - py.test 3
- yes
- yes
- yes
- yes
- yes
+ - yes
+ - yes
+ - yes
+ * - py.test 4
+ - no**
+ - no**
+ - no**
+ - no**
+ - no**
+ - no**
+ - no**
+ - no**
+ * - py.test fixtures
+ - no†
+ - no†
+ - no†
+ - no†
+ - no†
+ - no†
+ - no†
+ - no†
* - | unittest
| (``@parameterized.expand``)
- yes
@@ -224,6 +262,7 @@
- yes
- yes
- yes
+ - yes
* - | unittest2
| (``@parameterized.expand``)
- yes
@@ -233,6 +272,17 @@
- yes
- yes
- yes
+ - yes
+
+ \*: py.test 2 does `does not appear to work (#71)`__ under Python 3.
Please comment on the related issues if you are affected.
+
+ \*\*: py.test 4 is not yet supported (but coming!) in `issue #34`__
+
+ †: py.test fixture support is documented in `issue #81`__
+
+ __ https://github.com/wolever/parameterized/issues/71
+ __ https://github.com/wolever/parameterized/issues/34
+ __ https://github.com/wolever/parameterized/issues/81
Dependencies
------------
@@ -439,7 +489,7 @@
OK
- Finally ``@parameterized.expand_class`` parameterizes an entire class,
using
+ Finally ``@parameterized_class`` parameterizes an entire class, using
either a list of attributes, or a list of dicts that will be applied
to the
class:
@@ -481,27 +531,45 @@
def tearDown(self):
self.client.logout()
+ Using with Single Parameters
+ ............................
- Migrating from ``nose-parameterized`` to ``parameterized``
- ----------------------------------------------------------
+ If a test function only accepts one parameter and the value is not
iterable,
+ then it is possible to supply a list of values without wrapping each
one in a
+ tuple:
- To migrate a codebase from ``nose-parameterized`` to ``parameterized``:
+ .. code:: python
- 1. Update your requirements file, replacing ``nose-parameterized`` with
- ``parameterized``.
+ @parameterized([1, 2, 3])
+ def test_greater_than_zero(value):
+ assert value > 0
+
+ Note, however, that if the single parameter *is* iterable (such as a
list or
+ tuple), then it *must* be wrapped in a tuple, list, or the
``param(...)``
+ helper:
- 2. Replace all references to ``nose_parameterized`` with
``parameterized``::
+ .. code:: python
- $ perl -pi -e 's/nose_parameterized/parameterized/g' your-codebase/
+ @parameterized([
+ ([1, 2, 3], ),
+ ([3, 3], ),
+ ([6], ),
+ ])
+ def test_sums_to_6(numbers):
+ assert sum(numbers) == 6
+
+ (note, also, that Python requires single element tuples to be defined
with a
+ trailing comma: ``(foo, )``)
- 3. You're done!
- Using with ``mock.patch``
- -------------------------
+ Using with ``@mock.patch``
+ ..........................
``parameterized`` can be used with ``mock.patch``, but the argument
ordering
can be confusing. The ``@mock.patch(...)`` decorator must come *below*
the
- ``@parameterized(...)``, and the mocked parameters must come *last*::
+ ``@parameterized(...)``, and the mocked parameters must come *last*:
+
+ .. code:: python
@mock.patch("os.getpid")
class TestOS(object):
@@ -513,6 +581,22 @@
Note: the same holds true when using ``@parameterized.expand``.
+
+ Migrating from ``nose-parameterized`` to ``parameterized``
+ ----------------------------------------------------------
+
+ To migrate a codebase from ``nose-parameterized`` to ``parameterized``:
+
+ 1. Update your requirements file, replacing ``nose-parameterized`` with
+ ``parameterized``.
+
+ 2. Replace all references to ``nose_parameterized`` with
``parameterized``::
+
+ $ perl -pi -e 's/nose_parameterized/parameterized/g' your-codebase/
+
+ 3. You're done!
+
+
FAQ
---
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/parameterized-0.7.0/README.rst
new/parameterized-0.7.1/README.rst
--- old/parameterized-0.7.0/README.rst 2019-02-06 04:37:43.000000000 +0100
+++ new/parameterized-0.7.1/README.rst 2019-11-19 23:04:05.000000000 +0100
@@ -1,7 +1,14 @@
Parameterized testing with any Python test framework
====================================================
-.. image:: https://travis-ci.org/wolever/parameterized.svg?branch=master
+|pypi| |travis|
+
+.. |pypi| image:: https://img.shields.io/pypi/v/parameterized.svg
+ :alt: PyPI
+ :target: https://pypi.org/project/parameterized/
+
+.. |travis| image::
https://travis-ci.org/wolever/parameterized.svg?branch=master
+ :alt: Travis CI
:target: https://travis-ci.org/wolever/parameterized
Parameterized testing in Python sucks.
@@ -167,7 +174,7 @@
Compatibility
-------------
-`Yes`__.
+`Yes`__ (mostly).
__ https://travis-ci.org/wolever/parameterized
@@ -183,6 +190,7 @@
- Py3.6
- Py3.7
- PyPy
+ - ``@mock.patch``
* - nose
- yes
- yes
@@ -191,6 +199,7 @@
- yes
- yes
- yes
+ - yes
* - nose2
- yes
- yes
@@ -199,14 +208,43 @@
- yes
- yes
- yes
- * - py.test
+ - yes
+ * - py.test 2
+ - yes
+ - yes
+ - no*
+ - no*
+ - no*
+ - no*
- yes
- yes
+ * - py.test 3
- yes
- yes
- yes
- yes
- yes
+ - yes
+ - yes
+ - yes
+ * - py.test 4
+ - no**
+ - no**
+ - no**
+ - no**
+ - no**
+ - no**
+ - no**
+ - no**
+ * - py.test fixtures
+ - no†
+ - no†
+ - no†
+ - no†
+ - no†
+ - no†
+ - no†
+ - no†
* - | unittest
| (``@parameterized.expand``)
- yes
@@ -216,6 +254,7 @@
- yes
- yes
- yes
+ - yes
* - | unittest2
| (``@parameterized.expand``)
- yes
@@ -225,6 +264,17 @@
- yes
- yes
- yes
+ - yes
+
+\*: py.test 2 does `does not appear to work (#71)`__ under Python 3. Please
comment on the related issues if you are affected.
+
+\*\*: py.test 4 is not yet supported (but coming!) in `issue #34`__
+
+†: py.test fixture support is documented in `issue #81`__
+
+__ https://github.com/wolever/parameterized/issues/71
+__ https://github.com/wolever/parameterized/issues/34
+__ https://github.com/wolever/parameterized/issues/81
Dependencies
------------
@@ -431,7 +481,7 @@
OK
-Finally ``@parameterized.expand_class`` parameterizes an entire class, using
+Finally ``@parameterized_class`` parameterizes an entire class, using
either a list of attributes, or a list of dicts that will be applied to the
class:
@@ -473,27 +523,45 @@
def tearDown(self):
self.client.logout()
+Using with Single Parameters
+............................
-Migrating from ``nose-parameterized`` to ``parameterized``
-----------------------------------------------------------
+If a test function only accepts one parameter and the value is not iterable,
+then it is possible to supply a list of values without wrapping each one in a
+tuple:
-To migrate a codebase from ``nose-parameterized`` to ``parameterized``:
+.. code:: python
-1. Update your requirements file, replacing ``nose-parameterized`` with
- ``parameterized``.
+ @parameterized([1, 2, 3])
+ def test_greater_than_zero(value):
+ assert value > 0
+
+Note, however, that if the single parameter *is* iterable (such as a list or
+tuple), then it *must* be wrapped in a tuple, list, or the ``param(...)``
+helper:
-2. Replace all references to ``nose_parameterized`` with ``parameterized``::
+.. code:: python
- $ perl -pi -e 's/nose_parameterized/parameterized/g' your-codebase/
+ @parameterized([
+ ([1, 2, 3], ),
+ ([3, 3], ),
+ ([6], ),
+ ])
+ def test_sums_to_6(numbers):
+ assert sum(numbers) == 6
+
+(note, also, that Python requires single element tuples to be defined with a
+trailing comma: ``(foo, )``)
-3. You're done!
-Using with ``mock.patch``
--------------------------
+Using with ``@mock.patch``
+..........................
``parameterized`` can be used with ``mock.patch``, but the argument ordering
can be confusing. The ``@mock.patch(...)`` decorator must come *below* the
-``@parameterized(...)``, and the mocked parameters must come *last*::
+``@parameterized(...)``, and the mocked parameters must come *last*:
+
+.. code:: python
@mock.patch("os.getpid")
class TestOS(object):
@@ -505,6 +573,22 @@
Note: the same holds true when using ``@parameterized.expand``.
+
+Migrating from ``nose-parameterized`` to ``parameterized``
+----------------------------------------------------------
+
+To migrate a codebase from ``nose-parameterized`` to ``parameterized``:
+
+1. Update your requirements file, replacing ``nose-parameterized`` with
+ ``parameterized``.
+
+2. Replace all references to ``nose_parameterized`` with ``parameterized``::
+
+ $ perl -pi -e 's/nose_parameterized/parameterized/g' your-codebase/
+
+3. You're done!
+
+
FAQ
---
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/parameterized-0.7.0/parameterized/parameterized.py
new/parameterized-0.7.1/parameterized/parameterized.py
--- old/parameterized-0.7.0/parameterized/parameterized.py 2019-02-06
04:18:23.000000000 +0100
+++ new/parameterized-0.7.1/parameterized/parameterized.py 2019-11-19
23:04:03.000000000 +0100
@@ -591,4 +591,15 @@
test_class_module[name] = type(name, (base_class, ),
test_class_dict)
+ # We need to leave the base class in place (see issue #73), but if we
+ # leave the test_ methods in place, the test runner will try to pick
+ # them up and run them... which doesn't make sense, since no parameters
+ # will have been applied.
+ # Address this by iterating over the base class and remove all test
+ # methods.
+ for method_name in list(base_class.__dict__):
+ if method_name.startswith("test_"):
+ delattr(base_class, method_name)
+ return base_class
+
return decorator
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/parameterized-0.7.0/parameterized/test.py
new/parameterized-0.7.1/parameterized/test.py
--- old/parameterized-0.7.0/parameterized/test.py 2019-02-06
04:36:14.000000000 +0100
+++ new/parameterized-0.7.1/parameterized/test.py 2019-11-19
23:04:03.000000000 +0100
@@ -21,6 +21,7 @@
SKIP_FLAGS = {
"generator": UNITTEST,
+ "standalone": UNITTEST,
# nose2 doesn't run tests on old-style classes under Py2, so don't expect
# these tests to run under nose2.
"py2nose2": (PY2 and NOSE2),
@@ -44,7 +45,7 @@
param("foo2", bar=42),
]
-expect("generator", [
+expect("standalone", [
"test_naked_function('foo0', bar=None)",
"test_naked_function('foo1', bar=None)",
"test_naked_function('foo2', bar=42)",
@@ -165,12 +166,9 @@
(foo, mock_umask._mock_name))
expect([
- "test_multiple_function_patch_decorator"
- "(42, 51, 'umask', 'fdopen')",
- "test_multiple_function_patch_decorator"
- "('foo0', 'bar0', 'umask', 'fdopen')",
- "test_multiple_function_patch_decorator"
- "('foo1', 'bar1', 'umask', 'fdopen')",
+ "test_multiple_function_patch_decorator(42, 51, 'umask', 'fdopen')",
+ "test_multiple_function_patch_decorator('foo0', 'bar0', 'umask',
'fdopen')",
+ "test_multiple_function_patch_decorator('foo1', 'bar1', 'umask',
'fdopen')",
])
@parameterized.expand([(42, 51), ("foo0", "bar0"), param("foo1", "bar1")])
@@ -196,6 +194,20 @@
(foo, bar, mock_umask._mock_name))
+expect("standalone", [
+ "test_mock_patch_standalone_function(42, 'umask')",
+])
+
+@parameterized([(42, )])
[email protected]("os.umask")
+def test_mock_patch_standalone_function(foo, mock_umask):
+ missing_tests.remove(
+ "test_mock_patch_standalone_function(%r, %r)" %(
+ foo, mock_umask._mock_name
+ )
+ )
+
+
class TestParamerizedOnTestCase(TestCase):
expect([
"test_on_TestCase('foo0', bar=None)",
@@ -335,7 +347,7 @@
raise AssertionError("Expected exception not raised")
-expect("generator", [
+expect("stadalone generator", [
"test_wrapped_iterable_input('foo')",
])
@parameterized(lambda: iter(["foo"]))
@@ -469,13 +481,35 @@
])
class TestParameterizedClassDict(TestCase):
expect([
+ "TestParameterizedClassDict_0:setUp(1, 0)",
+ "TestParameterizedClassDict_0:tearDown(1, 0)",
"TestParameterizedClassDict_0:test_method(1, 0)",
"TestParameterizedClassDict_1:test_method(0, 1)",
+ "TestParameterizedClassDict_1:setUp(0, 1)",
+ "TestParameterizedClassDict_1:tearDown(0, 1)",
])
foo = 0
bar = 0
+ def setUp(self):
+ # Ensure that super() works (issue #73)
+ super(TestParameterizedClassDict, self).setUp()
+ missing_tests.remove("%s:setUp(%r, %r)" %(
+ self.__class__.__name__,
+ self.foo,
+ self.bar,
+ ))
+
+ def tearDown(self):
+ # Ensure that super() works (issue #73)
+ super(TestParameterizedClassDict, self).tearDown()
+ missing_tests.remove("%s:tearDown(%r, %r)" %(
+ self.__class__.__name__,
+ self.foo,
+ self.bar,
+ ))
+
def test_method(self):
missing_tests.remove("%s:test_method(%r, %r)" %(
self.__class__.__name__,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/parameterized-0.7.0/parameterized.egg-info/PKG-INFO
new/parameterized-0.7.1/parameterized.egg-info/PKG-INFO
--- old/parameterized-0.7.0/parameterized.egg-info/PKG-INFO 2019-02-06
04:43:34.000000000 +0100
+++ new/parameterized-0.7.1/parameterized.egg-info/PKG-INFO 2019-11-19
23:04:22.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: parameterized
-Version: 0.7.0
+Version: 0.7.1
Summary: Parameterized testing with any Python test framework
Home-page: https://github.com/wolever/parameterized
Author: David Wolever
@@ -9,7 +9,14 @@
Description: Parameterized testing with any Python test framework
====================================================
- .. image::
https://travis-ci.org/wolever/parameterized.svg?branch=master
+ |pypi| |travis|
+
+ .. |pypi| image:: https://img.shields.io/pypi/v/parameterized.svg
+ :alt: PyPI
+ :target: https://pypi.org/project/parameterized/
+
+ .. |travis| image::
https://travis-ci.org/wolever/parameterized.svg?branch=master
+ :alt: Travis CI
:target: https://travis-ci.org/wolever/parameterized
Parameterized testing in Python sucks.
@@ -175,7 +182,7 @@
Compatibility
-------------
- `Yes`__.
+ `Yes`__ (mostly).
__ https://travis-ci.org/wolever/parameterized
@@ -191,6 +198,7 @@
- Py3.6
- Py3.7
- PyPy
+ - ``@mock.patch``
* - nose
- yes
- yes
@@ -199,6 +207,7 @@
- yes
- yes
- yes
+ - yes
* - nose2
- yes
- yes
@@ -207,14 +216,43 @@
- yes
- yes
- yes
- * - py.test
+ - yes
+ * - py.test 2
+ - yes
+ - yes
+ - no*
+ - no*
+ - no*
+ - no*
- yes
- yes
+ * - py.test 3
- yes
- yes
- yes
- yes
- yes
+ - yes
+ - yes
+ - yes
+ * - py.test 4
+ - no**
+ - no**
+ - no**
+ - no**
+ - no**
+ - no**
+ - no**
+ - no**
+ * - py.test fixtures
+ - no†
+ - no†
+ - no†
+ - no†
+ - no†
+ - no†
+ - no†
+ - no†
* - | unittest
| (``@parameterized.expand``)
- yes
@@ -224,6 +262,7 @@
- yes
- yes
- yes
+ - yes
* - | unittest2
| (``@parameterized.expand``)
- yes
@@ -233,6 +272,17 @@
- yes
- yes
- yes
+ - yes
+
+ \*: py.test 2 does `does not appear to work (#71)`__ under Python 3.
Please comment on the related issues if you are affected.
+
+ \*\*: py.test 4 is not yet supported (but coming!) in `issue #34`__
+
+ †: py.test fixture support is documented in `issue #81`__
+
+ __ https://github.com/wolever/parameterized/issues/71
+ __ https://github.com/wolever/parameterized/issues/34
+ __ https://github.com/wolever/parameterized/issues/81
Dependencies
------------
@@ -439,7 +489,7 @@
OK
- Finally ``@parameterized.expand_class`` parameterizes an entire class,
using
+ Finally ``@parameterized_class`` parameterizes an entire class, using
either a list of attributes, or a list of dicts that will be applied
to the
class:
@@ -481,27 +531,45 @@
def tearDown(self):
self.client.logout()
+ Using with Single Parameters
+ ............................
- Migrating from ``nose-parameterized`` to ``parameterized``
- ----------------------------------------------------------
+ If a test function only accepts one parameter and the value is not
iterable,
+ then it is possible to supply a list of values without wrapping each
one in a
+ tuple:
- To migrate a codebase from ``nose-parameterized`` to ``parameterized``:
+ .. code:: python
- 1. Update your requirements file, replacing ``nose-parameterized`` with
- ``parameterized``.
+ @parameterized([1, 2, 3])
+ def test_greater_than_zero(value):
+ assert value > 0
+
+ Note, however, that if the single parameter *is* iterable (such as a
list or
+ tuple), then it *must* be wrapped in a tuple, list, or the
``param(...)``
+ helper:
- 2. Replace all references to ``nose_parameterized`` with
``parameterized``::
+ .. code:: python
- $ perl -pi -e 's/nose_parameterized/parameterized/g' your-codebase/
+ @parameterized([
+ ([1, 2, 3], ),
+ ([3, 3], ),
+ ([6], ),
+ ])
+ def test_sums_to_6(numbers):
+ assert sum(numbers) == 6
+
+ (note, also, that Python requires single element tuples to be defined
with a
+ trailing comma: ``(foo, )``)
- 3. You're done!
- Using with ``mock.patch``
- -------------------------
+ Using with ``@mock.patch``
+ ..........................
``parameterized`` can be used with ``mock.patch``, but the argument
ordering
can be confusing. The ``@mock.patch(...)`` decorator must come *below*
the
- ``@parameterized(...)``, and the mocked parameters must come *last*::
+ ``@parameterized(...)``, and the mocked parameters must come *last*:
+
+ .. code:: python
@mock.patch("os.getpid")
class TestOS(object):
@@ -513,6 +581,22 @@
Note: the same holds true when using ``@parameterized.expand``.
+
+ Migrating from ``nose-parameterized`` to ``parameterized``
+ ----------------------------------------------------------
+
+ To migrate a codebase from ``nose-parameterized`` to ``parameterized``:
+
+ 1. Update your requirements file, replacing ``nose-parameterized`` with
+ ``parameterized``.
+
+ 2. Replace all references to ``nose_parameterized`` with
``parameterized``::
+
+ $ perl -pi -e 's/nose_parameterized/parameterized/g' your-codebase/
+
+ 3. You're done!
+
+
FAQ
---
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/parameterized-0.7.0/parameterized.egg-info/pbr.json
new/parameterized-0.7.1/parameterized.egg-info/pbr.json
--- old/parameterized-0.7.0/parameterized.egg-info/pbr.json 2019-02-06
04:43:34.000000000 +0100
+++ new/parameterized-0.7.1/parameterized.egg-info/pbr.json 2019-11-19
23:04:22.000000000 +0100
@@ -1 +1 @@
-{"is_release": false, "git_version": "ec636fe"}
\ No newline at end of file
+{"is_release": false, "git_version": "4d73fbe"}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/parameterized-0.7.0/setup.py
new/parameterized-0.7.1/setup.py
--- old/parameterized-0.7.0/setup.py 2019-02-06 04:43:03.000000000 +0100
+++ new/parameterized-0.7.1/setup.py 2019-11-19 23:04:03.000000000 +0100
@@ -14,7 +14,7 @@
setup(
name="parameterized",
- version="0.7.0",
+ version="0.7.1",
url="https://github.com/wolever/parameterized",
license="FreeBSD",
author="David Wolever",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/parameterized-0.7.0/tox.ini
new/parameterized-0.7.1/tox.ini
--- old/parameterized-0.7.0/tox.ini 2019-02-06 04:17:48.000000000 +0100
+++ new/parameterized-0.7.1/tox.ini 2019-11-19 21:26:37.000000000 +0100
@@ -1,15 +1,19 @@
[tox]
-envlist=py{27,35,36,37,py}-{nose,nose2,pytest,unit,unit2}
+envlist=py{27,35,36,py}-{nose,nose2,pytest2,pytest3,unit,unit2},py37-{nose,nose2,pytest3,unit,unit2}
[testenv]
deps=
nose
mock
nose2: nose2
- pytest: pytest>=2,<3
+ pytest2: pytest>=2,<3
+ pytest3: pytest>=3,<4
+ #pytest4: pytest>=4,<5
unit2: unittest2
commands=
nose: nosetests
nose2: nose2
- pytest: py.test parameterized/test.py
+ pytest2: py.test parameterized/test.py
+ pytest3: py.test parameterized/test.py
+ #pytest4: py.test parameterized/test.py
unit: python -m unittest parameterized.test
unit2: unit2 parameterized.test
++++++ skip_Documentation_tests.patch ++++++
--- a/parameterized/test.py
+++ b/parameterized/test.py
@@ -2,7 +2,8 @@
import inspect
import mock
-from unittest import TestCase
+import sys
+from unittest import TestCase, skipIf
from nose.tools import assert_equal, assert_raises
from .parameterized import (
@@ -241,6 +242,7 @@ class TestParamerizedOnTestCase(TestCase
missing_tests.remove("%s(%r, bar=%r)" %(expected_name, foo, bar))
+@skipIf(sys.version_info[:2] >= (3, 8), "Doesn't work with Python 3.8")
class TestParameterizedExpandDocstring(TestCase):
def _assert_docstring(self, expected_docstring, rstrip=False):
""" Checks the current test method's docstring. Must be called directly