unittest-parametrize 1.5.0__tar.gz → 1.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {unittest_parametrize-1.5.0 → unittest_parametrize-1.6.0}/CHANGELOG.rst +7 -0
- {unittest_parametrize-1.5.0/src/unittest_parametrize.egg-info → unittest_parametrize-1.6.0}/PKG-INFO +3 -2
- {unittest_parametrize-1.5.0 → unittest_parametrize-1.6.0}/README.rst +2 -1
- {unittest_parametrize-1.5.0 → unittest_parametrize-1.6.0}/pyproject.toml +1 -1
- {unittest_parametrize-1.5.0 → unittest_parametrize-1.6.0}/src/unittest_parametrize/__init__.py +43 -17
- {unittest_parametrize-1.5.0 → unittest_parametrize-1.6.0/src/unittest_parametrize.egg-info}/PKG-INFO +3 -2
- {unittest_parametrize-1.5.0 → unittest_parametrize-1.6.0}/LICENSE +0 -0
- {unittest_parametrize-1.5.0 → unittest_parametrize-1.6.0}/MANIFEST.in +0 -0
- {unittest_parametrize-1.5.0 → unittest_parametrize-1.6.0}/setup.cfg +0 -0
- {unittest_parametrize-1.5.0 → unittest_parametrize-1.6.0}/src/unittest_parametrize/py.typed +0 -0
- {unittest_parametrize-1.5.0 → unittest_parametrize-1.6.0}/src/unittest_parametrize.egg-info/SOURCES.txt +0 -0
- {unittest_parametrize-1.5.0 → unittest_parametrize-1.6.0}/src/unittest_parametrize.egg-info/dependency_links.txt +0 -0
- {unittest_parametrize-1.5.0 → unittest_parametrize-1.6.0}/src/unittest_parametrize.egg-info/requires.txt +0 -0
- {unittest_parametrize-1.5.0 → unittest_parametrize-1.6.0}/src/unittest_parametrize.egg-info/top_level.txt +0 -0
@@ -2,6 +2,13 @@
|
|
2
2
|
Changelog
|
3
3
|
=========
|
4
4
|
|
5
|
+
1.6.0 (2025-01-06)
|
6
|
+
------------------
|
7
|
+
|
8
|
+
* Add suport for asynchronous tests.
|
9
|
+
|
10
|
+
Thanks to Adrien Cossa in `PR #121 <https://github.com/adamchainz/unittest-parametrize/pull/121>`__.
|
11
|
+
|
5
12
|
1.5.0 (2024-10-08)
|
6
13
|
------------------
|
7
14
|
|
{unittest_parametrize-1.5.0/src/unittest_parametrize.egg-info → unittest_parametrize-1.6.0}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: unittest-parametrize
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.6.0
|
4
4
|
Summary: Parametrize tests within unittest TestCases.
|
5
5
|
Author-email: Adam Johnson <me@adamj.eu>
|
6
6
|
Project-URL: Changelog, https://github.com/adamchainz/unittest-parametrize/blob/main/CHANGELOG.rst
|
@@ -73,7 +73,7 @@ __ https://docs.pytest.org/en/stable/how-to/parametrize.html#parametrize-basics
|
|
73
73
|
There are two steps to parametrize a test case:
|
74
74
|
|
75
75
|
1. Use ``ParametrizedTestCase`` in the base classes for your test case.
|
76
|
-
2. Apply ``@parametrize`` to any
|
76
|
+
2. Apply ``@parametrize`` to any test methods for parametrization.
|
77
77
|
This decorator takes (at least):
|
78
78
|
|
79
79
|
* the argument names to parametrize, as comma-separated string
|
@@ -101,6 +101,7 @@ Here’s a basic example:
|
|
101
101
|
``@parametrize`` modifies the class at definition time with Python’s |__init_subclass__ hook|__.
|
102
102
|
It removes the original test method and creates wrapped copies with individual names.
|
103
103
|
Thus the parametrization should work regardless of the test runner you use (be it unittest, Django’s test runner, pytest, etc.).
|
104
|
+
It supports both synchronous and asynchronous test methods.
|
104
105
|
|
105
106
|
.. |__init_subclass__ hook| replace:: ``__init_subclass__`` hook
|
106
107
|
__ https://docs.python.org/3/reference/datamodel.html#object.__init_subclass__
|
@@ -48,7 +48,7 @@ __ https://docs.pytest.org/en/stable/how-to/parametrize.html#parametrize-basics
|
|
48
48
|
There are two steps to parametrize a test case:
|
49
49
|
|
50
50
|
1. Use ``ParametrizedTestCase`` in the base classes for your test case.
|
51
|
-
2. Apply ``@parametrize`` to any
|
51
|
+
2. Apply ``@parametrize`` to any test methods for parametrization.
|
52
52
|
This decorator takes (at least):
|
53
53
|
|
54
54
|
* the argument names to parametrize, as comma-separated string
|
@@ -76,6 +76,7 @@ Here’s a basic example:
|
|
76
76
|
``@parametrize`` modifies the class at definition time with Python’s |__init_subclass__ hook|__.
|
77
77
|
It removes the original test method and creates wrapped copies with individual names.
|
78
78
|
Thus the parametrization should work regardless of the test runner you use (be it unittest, Django’s test runner, pytest, etc.).
|
79
|
+
It supports both synchronous and asynchronous test methods.
|
79
80
|
|
80
81
|
.. |__init_subclass__ hook| replace:: ``__init_subclass__`` hook
|
81
82
|
__ https://docs.python.org/3/reference/datamodel.html#object.__init_subclass__
|
{unittest_parametrize-1.5.0 → unittest_parametrize-1.6.0}/src/unittest_parametrize/__init__.py
RENAMED
@@ -40,23 +40,49 @@ class ParametrizedTestCase(TestCase):
|
|
40
40
|
for param in _parametrized.params:
|
41
41
|
params = dict(zip(_parametrized.argnames, param.args))
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
43
|
+
if inspect.iscoroutinefunction(func):
|
44
|
+
|
45
|
+
@wraps(func)
|
46
|
+
async def test(
|
47
|
+
self: TestCase,
|
48
|
+
*args: Any,
|
49
|
+
_func: FunctionType = func,
|
50
|
+
_params: dict[str, Any] = params,
|
51
|
+
**kwargs: Any,
|
52
|
+
) -> Any:
|
53
|
+
try:
|
54
|
+
return await _func(self, *args, **_params, **kwargs)
|
55
|
+
except Exception as exc:
|
56
|
+
if sys.version_info >= (3, 11):
|
57
|
+
exc.add_note(
|
58
|
+
"Test parameters: "
|
59
|
+
+ ", ".join(
|
60
|
+
f"{k}={v!r}" for k, v in _params.items()
|
61
|
+
)
|
62
|
+
)
|
63
|
+
raise
|
64
|
+
|
65
|
+
else:
|
66
|
+
|
67
|
+
@wraps(func)
|
68
|
+
def test(
|
69
|
+
self: TestCase,
|
70
|
+
*args: Any,
|
71
|
+
_func: FunctionType = func,
|
72
|
+
_params: dict[str, Any] = params,
|
73
|
+
**kwargs: Any,
|
74
|
+
) -> Any:
|
75
|
+
try:
|
76
|
+
return _func(self, *args, **_params, **kwargs)
|
77
|
+
except Exception as exc:
|
78
|
+
if sys.version_info >= (3, 11):
|
79
|
+
exc.add_note(
|
80
|
+
"Test parameters: "
|
81
|
+
+ ", ".join(
|
82
|
+
f"{k}={v!r}" for k, v in _params.items()
|
83
|
+
)
|
84
|
+
)
|
85
|
+
raise
|
60
86
|
|
61
87
|
test.__name__ = f"{name}_{param.id}"
|
62
88
|
test.__qualname__ = f"{test.__qualname__}_{param.id}"
|
{unittest_parametrize-1.5.0 → unittest_parametrize-1.6.0/src/unittest_parametrize.egg-info}/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: unittest-parametrize
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.6.0
|
4
4
|
Summary: Parametrize tests within unittest TestCases.
|
5
5
|
Author-email: Adam Johnson <me@adamj.eu>
|
6
6
|
Project-URL: Changelog, https://github.com/adamchainz/unittest-parametrize/blob/main/CHANGELOG.rst
|
@@ -73,7 +73,7 @@ __ https://docs.pytest.org/en/stable/how-to/parametrize.html#parametrize-basics
|
|
73
73
|
There are two steps to parametrize a test case:
|
74
74
|
|
75
75
|
1. Use ``ParametrizedTestCase`` in the base classes for your test case.
|
76
|
-
2. Apply ``@parametrize`` to any
|
76
|
+
2. Apply ``@parametrize`` to any test methods for parametrization.
|
77
77
|
This decorator takes (at least):
|
78
78
|
|
79
79
|
* the argument names to parametrize, as comma-separated string
|
@@ -101,6 +101,7 @@ Here’s a basic example:
|
|
101
101
|
``@parametrize`` modifies the class at definition time with Python’s |__init_subclass__ hook|__.
|
102
102
|
It removes the original test method and creates wrapped copies with individual names.
|
103
103
|
Thus the parametrization should work regardless of the test runner you use (be it unittest, Django’s test runner, pytest, etc.).
|
104
|
+
It supports both synchronous and asynchronous test methods.
|
104
105
|
|
105
106
|
.. |__init_subclass__ hook| replace:: ``__init_subclass__`` hook
|
106
107
|
__ https://docs.python.org/3/reference/datamodel.html#object.__init_subclass__
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|