unittest-parametrize 1.3.0__tar.gz → 1.5.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.
Files changed (18) hide show
  1. unittest_parametrize-1.5.0/CHANGELOG.rst +58 -0
  2. {unittest_parametrize-1.3.0/src/unittest_parametrize.egg-info → unittest_parametrize-1.5.0}/PKG-INFO +16 -19
  3. {unittest_parametrize-1.3.0 → unittest_parametrize-1.5.0}/README.rst +9 -9
  4. unittest_parametrize-1.5.0/pyproject.toml +89 -0
  5. unittest_parametrize-1.5.0/setup.cfg +4 -0
  6. {unittest_parametrize-1.3.0 → unittest_parametrize-1.5.0}/src/unittest_parametrize/__init__.py +12 -4
  7. {unittest_parametrize-1.3.0 → unittest_parametrize-1.5.0/src/unittest_parametrize.egg-info}/PKG-INFO +17 -20
  8. {unittest_parametrize-1.3.0 → unittest_parametrize-1.5.0}/src/unittest_parametrize.egg-info/SOURCES.txt +0 -2
  9. unittest_parametrize-1.3.0/CHANGELOG.rst +0 -25
  10. unittest_parametrize-1.3.0/pyproject.toml +0 -28
  11. unittest_parametrize-1.3.0/setup.cfg +0 -66
  12. unittest_parametrize-1.3.0/src/unittest_parametrize.egg-info/not-zip-safe +0 -1
  13. {unittest_parametrize-1.3.0 → unittest_parametrize-1.5.0}/LICENSE +0 -0
  14. {unittest_parametrize-1.3.0 → unittest_parametrize-1.5.0}/MANIFEST.in +0 -0
  15. {unittest_parametrize-1.3.0 → unittest_parametrize-1.5.0}/src/unittest_parametrize/py.typed +0 -0
  16. {unittest_parametrize-1.3.0 → unittest_parametrize-1.5.0}/src/unittest_parametrize.egg-info/dependency_links.txt +0 -0
  17. {unittest_parametrize-1.3.0 → unittest_parametrize-1.5.0}/src/unittest_parametrize.egg-info/requires.txt +0 -0
  18. {unittest_parametrize-1.3.0 → unittest_parametrize-1.5.0}/src/unittest_parametrize.egg-info/top_level.txt +0 -0
@@ -0,0 +1,58 @@
1
+ =========
2
+ Changelog
3
+ =========
4
+
5
+ 1.5.0 (2024-10-08)
6
+ ------------------
7
+
8
+ * On Python 3.11+, add `exception notes <https://docs.python.org/3.11/whatsnew/3.11.html#whatsnew311-pep678>`__ xwith parameter values to failures.
9
+ For example, the final line here:
10
+
11
+ .. code-block:: console
12
+
13
+ $ python -m unittest example
14
+ F
15
+ ======================================================================
16
+ FAIL: test_square_0 (example.SquareTests.test_square_0)
17
+ ----------------------------------------------------------------------
18
+ Traceback (most recent call last):
19
+ File "/.../unittest_parametrize/__init__.py", line 52, in test
20
+ return _func(self, *args, **_params, **kwargs)
21
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22
+ File "/.../example.py", line 11, in test_square
23
+ self.assertEqual(x**2, expected)
24
+ AssertionError: 1 != 2
25
+ Test parameters: x=1, expected=2
26
+
27
+ * Drop Python 3.8 support.
28
+
29
+ * Support Python 3.13.
30
+
31
+ 1.4.0 (2023-10-12)
32
+ ------------------
33
+
34
+ * Support whitespace in argument name strings.
35
+
36
+ Thanks to Arthur Rio in `PR #47 <https://github.com/adamchainz/unittest-parametrize/pull/47>`__.
37
+
38
+ 1.3.0 (2023-07-10)
39
+ ------------------
40
+
41
+ * Drop Python 3.7 support.
42
+
43
+ 1.2.0 (2023-06-16)
44
+ ------------------
45
+
46
+ * Make ``param.id`` optional.
47
+
48
+ Thanks to Adrien Cossa in `PR #20 <https://github.com/adamchainz/unittest-parametrize/pull/20>`__.
49
+
50
+ 1.1.0 (2023-06-13)
51
+ ------------------
52
+
53
+ * Support Python 3.12.
54
+
55
+ 1.0.0 (2023-03-28)
56
+ ------------------
57
+
58
+ * First release.
@@ -1,36 +1,33 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: unittest-parametrize
3
- Version: 1.3.0
3
+ Version: 1.5.0
4
4
  Summary: Parametrize tests within unittest TestCases.
5
- Home-page: https://github.com/adamchainz/unittest-parametrize
6
- Author: Adam Johnson
7
- Author-email: me@adamj.eu
8
- License: MIT
5
+ Author-email: Adam Johnson <me@adamj.eu>
9
6
  Project-URL: Changelog, https://github.com/adamchainz/unittest-parametrize/blob/main/CHANGELOG.rst
10
- Project-URL: Mastodon, https://fosstodon.org/@adamchainz
11
- Project-URL: Twitter, https://twitter.com/adamchainz
7
+ Project-URL: Funding, https://adamj.eu/books/
8
+ Project-URL: Repository, https://github.com/adamchainz/unittest-parametrize
12
9
  Keywords: unittest
13
10
  Classifier: Development Status :: 5 - Production/Stable
14
11
  Classifier: Intended Audience :: Developers
15
12
  Classifier: License :: OSI Approved :: MIT License
16
13
  Classifier: Natural Language :: English
17
- Classifier: Programming Language :: Python :: 3
18
14
  Classifier: Programming Language :: Python :: 3 :: Only
19
- Classifier: Programming Language :: Python :: 3.8
20
15
  Classifier: Programming Language :: Python :: 3.9
21
16
  Classifier: Programming Language :: Python :: 3.10
22
17
  Classifier: Programming Language :: Python :: 3.11
23
18
  Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
24
20
  Classifier: Typing :: Typed
25
- Requires-Python: >=3.8
21
+ Requires-Python: >=3.9
26
22
  Description-Content-Type: text/x-rst
27
23
  License-File: LICENSE
24
+ Requires-Dist: typing-extensions; python_version < "3.10"
28
25
 
29
26
  ====================
30
27
  unittest-parametrize
31
28
  ====================
32
29
 
33
- .. image:: https://img.shields.io/github/actions/workflow/status/adamchainz/unittest-parametrize/main.yml?branch=main&style=for-the-badge
30
+ .. image:: https://img.shields.io/github/actions/workflow/status/adamchainz/unittest-parametrize/main.yml.svg?branch=main&style=for-the-badge
34
31
  :target: https://github.com/adamchainz/unittest-parametrize/actions?workflow=CI
35
32
 
36
33
  .. image:: https://img.shields.io/pypi/v/unittest-parametrize.svg?style=for-the-badge
@@ -45,6 +42,13 @@ unittest-parametrize
45
42
 
46
43
  Parametrize tests within unittest TestCases.
47
44
 
45
+ ----
46
+
47
+ **Testing a Django project?**
48
+ Check out my book `Speed Up Your Django Tests <https://adamchainz.gumroad.com/l/suydt>`__ which covers loads of recommendations to write faster, more accurate tests.
49
+
50
+ ----
51
+
48
52
  Installation
49
53
  ============
50
54
 
@@ -54,14 +58,7 @@ Install with:
54
58
 
55
59
  python -m pip install unittest-parametrize
56
60
 
57
- Python 3.8 to 3.12 supported.
58
-
59
- ----
60
-
61
- **Testing a Django project?**
62
- Check out my book `Speed Up Your Django Tests <https://adamchainz.gumroad.com/l/suydt>`__ which covers loads of recommendations to write faster, more accurate tests.
63
-
64
- ----
61
+ Python 3.9 to 3.13 supported.
65
62
 
66
63
  Usage
67
64
  =====
@@ -2,7 +2,7 @@
2
2
  unittest-parametrize
3
3
  ====================
4
4
 
5
- .. image:: https://img.shields.io/github/actions/workflow/status/adamchainz/unittest-parametrize/main.yml?branch=main&style=for-the-badge
5
+ .. image:: https://img.shields.io/github/actions/workflow/status/adamchainz/unittest-parametrize/main.yml.svg?branch=main&style=for-the-badge
6
6
  :target: https://github.com/adamchainz/unittest-parametrize/actions?workflow=CI
7
7
 
8
8
  .. image:: https://img.shields.io/pypi/v/unittest-parametrize.svg?style=for-the-badge
@@ -17,6 +17,13 @@ unittest-parametrize
17
17
 
18
18
  Parametrize tests within unittest TestCases.
19
19
 
20
+ ----
21
+
22
+ **Testing a Django project?**
23
+ Check out my book `Speed Up Your Django Tests <https://adamchainz.gumroad.com/l/suydt>`__ which covers loads of recommendations to write faster, more accurate tests.
24
+
25
+ ----
26
+
20
27
  Installation
21
28
  ============
22
29
 
@@ -26,14 +33,7 @@ Install with:
26
33
 
27
34
  python -m pip install unittest-parametrize
28
35
 
29
- Python 3.8 to 3.12 supported.
30
-
31
- ----
32
-
33
- **Testing a Django project?**
34
- Check out my book `Speed Up Your Django Tests <https://adamchainz.gumroad.com/l/suydt>`__ which covers loads of recommendations to write faster, more accurate tests.
35
-
36
- ----
36
+ Python 3.9 to 3.13 supported.
37
37
 
38
38
  Usage
39
39
  =====
@@ -0,0 +1,89 @@
1
+ [build-system]
2
+ build-backend = "setuptools.build_meta"
3
+ requires = [
4
+ "setuptools",
5
+ ]
6
+
7
+ [project]
8
+ name = "unittest-parametrize"
9
+ version = "1.5.0"
10
+ description = "Parametrize tests within unittest TestCases."
11
+ readme = "README.rst"
12
+ keywords = [
13
+ "unittest",
14
+ ]
15
+ authors = [
16
+ { name = "Adam Johnson", email = "me@adamj.eu" },
17
+ ]
18
+ requires-python = ">=3.9"
19
+ classifiers = [
20
+ "Development Status :: 5 - Production/Stable",
21
+ "Intended Audience :: Developers",
22
+ "License :: OSI Approved :: MIT License",
23
+ "Natural Language :: English",
24
+ "Programming Language :: Python :: 3 :: Only",
25
+ "Programming Language :: Python :: 3.9",
26
+ "Programming Language :: Python :: 3.10",
27
+ "Programming Language :: Python :: 3.11",
28
+ "Programming Language :: Python :: 3.12",
29
+ "Programming Language :: Python :: 3.13",
30
+ "Typing :: Typed",
31
+ ]
32
+ dependencies = [
33
+ "typing-extensions; python_version<'3.10'",
34
+ ]
35
+ urls.Changelog = "https://github.com/adamchainz/unittest-parametrize/blob/main/CHANGELOG.rst"
36
+ urls.Funding = "https://adamj.eu/books/"
37
+ urls.Repository = "https://github.com/adamchainz/unittest-parametrize"
38
+
39
+ [tool.isort]
40
+ add_imports = [
41
+ "from __future__ import annotations",
42
+ ]
43
+ force_single_line = true
44
+ profile = "black"
45
+
46
+ [tool.pyproject-fmt]
47
+ max_supported_python = "3.13"
48
+
49
+ [tool.pytest.ini_options]
50
+ addopts = """\
51
+ --strict-config
52
+ --strict-markers
53
+ """
54
+ xfail_strict = true
55
+
56
+ [tool.coverage.run]
57
+ branch = true
58
+ parallel = true
59
+ source = [
60
+ "unittest_parametrize",
61
+ "tests",
62
+ ]
63
+
64
+ [tool.coverage.paths]
65
+ source = [
66
+ "src",
67
+ ".tox/**/site-packages",
68
+ ]
69
+
70
+ [tool.coverage.report]
71
+ show_missing = true
72
+
73
+ [tool.mypy]
74
+ enable_error_code = [
75
+ "ignore-without-code",
76
+ "redundant-expr",
77
+ "truthy-bool",
78
+ ]
79
+ mypy_path = "src/"
80
+ namespace_packages = false
81
+ strict = true
82
+ warn_unreachable = true
83
+
84
+ [[tool.mypy.overrides]]
85
+ module = "tests.*"
86
+ allow_untyped_defs = true
87
+
88
+ [tool.rstcheck]
89
+ report_level = "ERROR"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -2,11 +2,11 @@ from __future__ import annotations
2
2
 
3
3
  import inspect
4
4
  import sys
5
+ from collections.abc import Sequence
5
6
  from functools import wraps
6
7
  from types import FunctionType
7
8
  from typing import Any
8
9
  from typing import Callable
9
- from typing import Sequence
10
10
  from typing import TypeVar
11
11
  from unittest import TestCase
12
12
 
@@ -48,7 +48,15 @@ class ParametrizedTestCase(TestCase):
48
48
  _params: dict[str, Any] = params,
49
49
  **kwargs: Any,
50
50
  ) -> Any:
51
- return _func(self, *args, **_params, **kwargs)
51
+ try:
52
+ return _func(self, *args, **_params, **kwargs)
53
+ except Exception as exc:
54
+ if sys.version_info >= (3, 11):
55
+ exc.add_note(
56
+ "Test parameters: "
57
+ + ", ".join(f"{k}={v!r}" for k, v in _params.items())
58
+ )
59
+ raise
52
60
 
53
61
  test.__name__ = f"{name}_{param.id}"
54
62
  test.__qualname__ = f"{test.__qualname__}_{param.id}"
@@ -92,7 +100,7 @@ def parametrize(
92
100
  ids: Sequence[str | None] | None = None,
93
101
  ) -> Callable[[Callable[P, T]], Callable[P, T]]:
94
102
  if isinstance(argnames, str):
95
- argnames = argnames.split(",")
103
+ argnames = [a.strip() for a in argnames.split(",")]
96
104
 
97
105
  if len(argnames) == 0:
98
106
  raise ValueError("argnames must contain at least one element")
@@ -135,7 +143,7 @@ def parametrize(
135
143
  )
136
144
 
137
145
  _parametrized = parametrized(argnames, params)
138
- bind_kwargs = {k: None for k in _parametrized.argnames}
146
+ bind_kwargs = dict.fromkeys(_parametrized.argnames)
139
147
 
140
148
  def wrapper(func: Callable[P, T]) -> Callable[P, T]:
141
149
  # Check given argnames will work
@@ -1,36 +1,33 @@
1
1
  Metadata-Version: 2.1
2
- Name: unittest_parametrize
3
- Version: 1.3.0
2
+ Name: unittest-parametrize
3
+ Version: 1.5.0
4
4
  Summary: Parametrize tests within unittest TestCases.
5
- Home-page: https://github.com/adamchainz/unittest-parametrize
6
- Author: Adam Johnson
7
- Author-email: me@adamj.eu
8
- License: MIT
5
+ Author-email: Adam Johnson <me@adamj.eu>
9
6
  Project-URL: Changelog, https://github.com/adamchainz/unittest-parametrize/blob/main/CHANGELOG.rst
10
- Project-URL: Mastodon, https://fosstodon.org/@adamchainz
11
- Project-URL: Twitter, https://twitter.com/adamchainz
7
+ Project-URL: Funding, https://adamj.eu/books/
8
+ Project-URL: Repository, https://github.com/adamchainz/unittest-parametrize
12
9
  Keywords: unittest
13
10
  Classifier: Development Status :: 5 - Production/Stable
14
11
  Classifier: Intended Audience :: Developers
15
12
  Classifier: License :: OSI Approved :: MIT License
16
13
  Classifier: Natural Language :: English
17
- Classifier: Programming Language :: Python :: 3
18
14
  Classifier: Programming Language :: Python :: 3 :: Only
19
- Classifier: Programming Language :: Python :: 3.8
20
15
  Classifier: Programming Language :: Python :: 3.9
21
16
  Classifier: Programming Language :: Python :: 3.10
22
17
  Classifier: Programming Language :: Python :: 3.11
23
18
  Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
24
20
  Classifier: Typing :: Typed
25
- Requires-Python: >=3.8
21
+ Requires-Python: >=3.9
26
22
  Description-Content-Type: text/x-rst
27
23
  License-File: LICENSE
24
+ Requires-Dist: typing-extensions; python_version < "3.10"
28
25
 
29
26
  ====================
30
27
  unittest-parametrize
31
28
  ====================
32
29
 
33
- .. image:: https://img.shields.io/github/actions/workflow/status/adamchainz/unittest-parametrize/main.yml?branch=main&style=for-the-badge
30
+ .. image:: https://img.shields.io/github/actions/workflow/status/adamchainz/unittest-parametrize/main.yml.svg?branch=main&style=for-the-badge
34
31
  :target: https://github.com/adamchainz/unittest-parametrize/actions?workflow=CI
35
32
 
36
33
  .. image:: https://img.shields.io/pypi/v/unittest-parametrize.svg?style=for-the-badge
@@ -45,6 +42,13 @@ unittest-parametrize
45
42
 
46
43
  Parametrize tests within unittest TestCases.
47
44
 
45
+ ----
46
+
47
+ **Testing a Django project?**
48
+ Check out my book `Speed Up Your Django Tests <https://adamchainz.gumroad.com/l/suydt>`__ which covers loads of recommendations to write faster, more accurate tests.
49
+
50
+ ----
51
+
48
52
  Installation
49
53
  ============
50
54
 
@@ -54,14 +58,7 @@ Install with:
54
58
 
55
59
  python -m pip install unittest-parametrize
56
60
 
57
- Python 3.8 to 3.12 supported.
58
-
59
- ----
60
-
61
- **Testing a Django project?**
62
- Check out my book `Speed Up Your Django Tests <https://adamchainz.gumroad.com/l/suydt>`__ which covers loads of recommendations to write faster, more accurate tests.
63
-
64
- ----
61
+ Python 3.9 to 3.13 supported.
65
62
 
66
63
  Usage
67
64
  =====
@@ -3,12 +3,10 @@ LICENSE
3
3
  MANIFEST.in
4
4
  README.rst
5
5
  pyproject.toml
6
- setup.cfg
7
6
  src/unittest_parametrize/__init__.py
8
7
  src/unittest_parametrize/py.typed
9
8
  src/unittest_parametrize.egg-info/PKG-INFO
10
9
  src/unittest_parametrize.egg-info/SOURCES.txt
11
10
  src/unittest_parametrize.egg-info/dependency_links.txt
12
- src/unittest_parametrize.egg-info/not-zip-safe
13
11
  src/unittest_parametrize.egg-info/requires.txt
14
12
  src/unittest_parametrize.egg-info/top_level.txt
@@ -1,25 +0,0 @@
1
- =========
2
- Changelog
3
- =========
4
-
5
- 1.3.0 (2023-07-10)
6
- ------------------
7
-
8
- * Drop Python 3.7 support.
9
-
10
- 1.2.0 (2023-06-16)
11
- ------------------
12
-
13
- * Make ``param.id`` optional.
14
-
15
- Thanks to Adrien Cossa in `PR #20 <https://github.com/adamchainz/unittest-parametrize/pull/20>`__.
16
-
17
- 1.1.0 (2023-06-13)
18
- ------------------
19
-
20
- * Support Python 3.12.
21
-
22
- 1.0.0 (2023-03-28)
23
- ------------------
24
-
25
- * First release.
@@ -1,28 +0,0 @@
1
- [build-system]
2
- build-backend = "setuptools.build_meta"
3
- requires = [
4
- "setuptools",
5
- ]
6
-
7
- [tool.black]
8
- target-version = ['py38']
9
-
10
- [tool.pytest.ini_options]
11
- addopts = """\
12
- --strict-config
13
- --strict-markers
14
- """
15
-
16
- [tool.mypy]
17
- mypy_path = "src/"
18
- namespace_packages = false
19
- show_error_codes = true
20
- strict = true
21
- warn_unreachable = true
22
-
23
- [[tool.mypy.overrides]]
24
- module = "tests.*"
25
- allow_untyped_defs = true
26
-
27
- [tool.rstcheck]
28
- report_level = "ERROR"
@@ -1,66 +0,0 @@
1
- [metadata]
2
- name = unittest_parametrize
3
- version = 1.3.0
4
- description = Parametrize tests within unittest TestCases.
5
- long_description = file: README.rst
6
- long_description_content_type = text/x-rst
7
- url = https://github.com/adamchainz/unittest-parametrize
8
- author = Adam Johnson
9
- author_email = me@adamj.eu
10
- license = MIT
11
- license_files = LICENSE
12
- classifiers =
13
- Development Status :: 5 - Production/Stable
14
- Intended Audience :: Developers
15
- License :: OSI Approved :: MIT License
16
- Natural Language :: English
17
- Programming Language :: Python :: 3
18
- Programming Language :: Python :: 3 :: Only
19
- Programming Language :: Python :: 3.8
20
- Programming Language :: Python :: 3.9
21
- Programming Language :: Python :: 3.10
22
- Programming Language :: Python :: 3.11
23
- Programming Language :: Python :: 3.12
24
- Typing :: Typed
25
- keywords = unittest
26
- project_urls =
27
- Changelog = https://github.com/adamchainz/unittest-parametrize/blob/main/CHANGELOG.rst
28
- Mastodon = https://fosstodon.org/@adamchainz
29
- Twitter = https://twitter.com/adamchainz
30
-
31
- [options]
32
- packages = find:
33
- install_requires =
34
- typing-extensions;python_version < "3.10"
35
- python_requires = >=3.8
36
- include_package_data = True
37
- package_dir =
38
- =src
39
- zip_safe = False
40
-
41
- [options.packages.find]
42
- where = src
43
-
44
- [coverage:run]
45
- branch = True
46
- parallel = True
47
- source =
48
- unittest_parametrize
49
- tests
50
-
51
- [coverage:paths]
52
- source =
53
- src
54
- .tox/**/site-packages
55
-
56
- [coverage:report]
57
- show_missing = True
58
-
59
- [flake8]
60
- max-line-length = 88
61
- extend-ignore = E203
62
-
63
- [egg_info]
64
- tag_build =
65
- tag_date = 0
66
-