pytest-asyncio-concurrent 0.1.2__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.
@@ -0,0 +1,22 @@
1
+
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2024 Zane Chen
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
@@ -0,0 +1,171 @@
1
+ Metadata-Version: 2.1
2
+ Name: pytest-asyncio-concurrent
3
+ Version: 0.1.2
4
+ Summary: Pytest plugin to execute python async tests concurrently.
5
+ Author-email: Zane Chen <czl970721@gmail.com>
6
+ Maintainer-email: Zane Chen <czl970721@gmail.com>
7
+ License:
8
+ The MIT License (MIT)
9
+
10
+ Copyright (c) 2024 Zane Chen
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy
13
+ of this software and associated documentation files (the "Software"), to deal
14
+ in the Software without restriction, including without limitation the rights
15
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
+ copies of the Software, and to permit persons to whom the Software is
17
+ furnished to do so, subject to the following conditions:
18
+
19
+ The above copyright notice and this permission notice shall be included in
20
+ all copies or substantial portions of the Software.
21
+
22
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28
+ THE SOFTWARE.
29
+
30
+ Project-URL: Repository, https://github.com/czl9707/pytest-asyncio-concurrent
31
+ Project-URL: Homepage, https://github.com/czl9707/pytest-asyncio-concurrent
32
+ Project-URL: Issues, https://github.com/czl9707/pytest-asyncio-concurrent/issues
33
+ Classifier: Framework :: Pytest
34
+ Classifier: Development Status :: 4 - Beta
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: Topic :: Software Development :: Testing
37
+ Classifier: Operating System :: OS Independent
38
+ Classifier: Programming Language :: Python
39
+ Classifier: Programming Language :: Python :: 3.8
40
+ Classifier: Programming Language :: Python :: 3.9
41
+ Classifier: Programming Language :: Python :: 3.10
42
+ Classifier: Programming Language :: Python :: 3.11
43
+ Classifier: Programming Language :: Python :: 3.12
44
+ Classifier: Programming Language :: Python :: 3.13
45
+ Classifier: Programming Language :: Python :: 3 :: Only
46
+ Classifier: License :: OSI Approved :: MIT License
47
+ Requires-Python: >=3.8
48
+ Description-Content-Type: text/x-rst
49
+ License-File: LICENSE
50
+ Requires-Dist: pytest>=6.2.0
51
+ Provides-Extra: testing
52
+ Requires-Dist: coverage>=7.6.0; extra == "testing"
53
+
54
+ =========================
55
+ pytest-asyncio-concurrent
56
+ =========================
57
+
58
+ .. image:: https://img.shields.io/pypi/v/pytest-asyncio-concurrent.svg
59
+ :target: https://pypi.org/project/pytest-asyncio-concurrent
60
+ :alt: PyPI version
61
+
62
+ .. image:: https://img.shields.io/pypi/pyversions/pytest-asyncio-concurrent.svg
63
+ :target: https://pypi.org/project/pytest-asyncio-concurrent
64
+ :alt: Python versions
65
+
66
+ .. image:: https://codecov.io/github/czl9707/pytest-asyncio-concurrent/graph/badge.svg?token=ENWHQBWQML
67
+ :target: https://codecov.io/gh/czl9707/pytest-asyncio-concurrent
68
+ :alt: Testing Coverage
69
+
70
+ .. image:: https://github.com/czl9707/pytest-asyncio-concurrent/actions/workflows/main.yml/badge.svg
71
+ :target: https://github.com/czl9707/pytest-asyncio-concurrent/actions/workflows/main.yml
72
+ :alt: See Build Status on GitHub Actions
73
+
74
+
75
+ =========================
76
+
77
+ System/Integration tests can take a really long time.
78
+
79
+ And ``pytest-asyncio-concurrent`` A pytest plugin is a solution for this by running asynchronous tests in true parallel, enabling faster execution for high I/O or network-bound test suites.
80
+
81
+ Unlike ``pytest-asyncio``, which runs async tests **sequentially**, ``pytest-asyncio-concurrent`` takes advantage of Python's asyncio capabilities to execute tests **concurrently** by specifying **async group**.
82
+
83
+ Note: This plugin would more or less `Break Test Isolation Principle` \(for none function scoped fixture\). Please make sure your tests is ok to run concurrently before you use this plugin.
84
+
85
+
86
+ Key Features
87
+ ------------
88
+
89
+ - Giving the capability to run pytest async functions.
90
+ - Providing granular control over Concurrency
91
+ - Specifying Async Group to control tests that can run together.
92
+ - Specifying Timeout to avoid async tests taking forever. (Under Construction)
93
+ - Compatible with ``pytest-asyncio``.
94
+
95
+ Installation
96
+ ------------
97
+
98
+ You can install "pytest-asyncio-concurrent" via `pip` from `PyPI`::
99
+
100
+ $ pip install pytest-asyncio-concurrent
101
+
102
+
103
+ Usage
104
+ -----
105
+
106
+ Run test Sequentially
107
+
108
+ .. code-block:: python
109
+
110
+ @pytest.mark.asyncio_concurrent
111
+ async def async_test_A():
112
+ res = await wait_for_something_async()
113
+ assert result.is_valid()
114
+
115
+ @pytest.mark.asyncio_concurrent
116
+ async def async_test_B():
117
+ res = await wait_for_something_async()
118
+ assert result.is_valid()
119
+
120
+
121
+ Run tests Concurrently
122
+
123
+ .. code-block:: python
124
+
125
+ # the test below will run by itself
126
+ @pytest.mark.asyncio_concurrent
127
+ async def test_by_itself():
128
+ res = await wait_for_something_async()
129
+ assert result.is_valid()
130
+
131
+ # the two tests below will run concurrently
132
+ @pytest.mark.asyncio_concurrent(group="my_group")
133
+ async def test_groupA():
134
+ res = await wait_for_something_async()
135
+ assert result.is_valid()
136
+
137
+ @pytest.mark.asyncio_concurrent(group="my_group")
138
+ async def test_groupB():
139
+ res = await wait_for_something_async()
140
+ assert result.is_valid()
141
+
142
+
143
+ Parametrized Tests
144
+
145
+ .. code-block:: python
146
+
147
+ # the parametrized tests below will run sequential
148
+ @pytest.mark.asyncio_concurrent
149
+ @pytest.parametrize("p", [0, 1, 2])
150
+ async def test_parametrize_sequential(p):
151
+ res = await wait_for_something_async()
152
+ assert result.is_valid()
153
+
154
+ # the parametrized tests below will run concurrently
155
+ @pytest.mark.asyncio_concurrent(group="my_group")
156
+ @pytest.parametrize("p", [0, 1, 2])
157
+ async def test_parametrize_concurrent():
158
+ res = await wait_for_something_async()
159
+ assert result.is_valid()
160
+
161
+
162
+ Contributing
163
+ ------------
164
+
165
+ Contributions are very welcome. Tests can be run with ``tox``, please ensure
166
+ the coverage at least stays the same before you submit a pull request.
167
+
168
+ License
169
+ -------
170
+
171
+ Distributed under the terms of the ``MIT`` license, "pytest-asyncio-concurrent" is free and open source software
@@ -0,0 +1,118 @@
1
+ =========================
2
+ pytest-asyncio-concurrent
3
+ =========================
4
+
5
+ .. image:: https://img.shields.io/pypi/v/pytest-asyncio-concurrent.svg
6
+ :target: https://pypi.org/project/pytest-asyncio-concurrent
7
+ :alt: PyPI version
8
+
9
+ .. image:: https://img.shields.io/pypi/pyversions/pytest-asyncio-concurrent.svg
10
+ :target: https://pypi.org/project/pytest-asyncio-concurrent
11
+ :alt: Python versions
12
+
13
+ .. image:: https://codecov.io/github/czl9707/pytest-asyncio-concurrent/graph/badge.svg?token=ENWHQBWQML
14
+ :target: https://codecov.io/gh/czl9707/pytest-asyncio-concurrent
15
+ :alt: Testing Coverage
16
+
17
+ .. image:: https://github.com/czl9707/pytest-asyncio-concurrent/actions/workflows/main.yml/badge.svg
18
+ :target: https://github.com/czl9707/pytest-asyncio-concurrent/actions/workflows/main.yml
19
+ :alt: See Build Status on GitHub Actions
20
+
21
+
22
+ =========================
23
+
24
+ System/Integration tests can take a really long time.
25
+
26
+ And ``pytest-asyncio-concurrent`` A pytest plugin is a solution for this by running asynchronous tests in true parallel, enabling faster execution for high I/O or network-bound test suites.
27
+
28
+ Unlike ``pytest-asyncio``, which runs async tests **sequentially**, ``pytest-asyncio-concurrent`` takes advantage of Python's asyncio capabilities to execute tests **concurrently** by specifying **async group**.
29
+
30
+ Note: This plugin would more or less `Break Test Isolation Principle` \(for none function scoped fixture\). Please make sure your tests is ok to run concurrently before you use this plugin.
31
+
32
+
33
+ Key Features
34
+ ------------
35
+
36
+ - Giving the capability to run pytest async functions.
37
+ - Providing granular control over Concurrency
38
+ - Specifying Async Group to control tests that can run together.
39
+ - Specifying Timeout to avoid async tests taking forever. (Under Construction)
40
+ - Compatible with ``pytest-asyncio``.
41
+
42
+ Installation
43
+ ------------
44
+
45
+ You can install "pytest-asyncio-concurrent" via `pip` from `PyPI`::
46
+
47
+ $ pip install pytest-asyncio-concurrent
48
+
49
+
50
+ Usage
51
+ -----
52
+
53
+ Run test Sequentially
54
+
55
+ .. code-block:: python
56
+
57
+ @pytest.mark.asyncio_concurrent
58
+ async def async_test_A():
59
+ res = await wait_for_something_async()
60
+ assert result.is_valid()
61
+
62
+ @pytest.mark.asyncio_concurrent
63
+ async def async_test_B():
64
+ res = await wait_for_something_async()
65
+ assert result.is_valid()
66
+
67
+
68
+ Run tests Concurrently
69
+
70
+ .. code-block:: python
71
+
72
+ # the test below will run by itself
73
+ @pytest.mark.asyncio_concurrent
74
+ async def test_by_itself():
75
+ res = await wait_for_something_async()
76
+ assert result.is_valid()
77
+
78
+ # the two tests below will run concurrently
79
+ @pytest.mark.asyncio_concurrent(group="my_group")
80
+ async def test_groupA():
81
+ res = await wait_for_something_async()
82
+ assert result.is_valid()
83
+
84
+ @pytest.mark.asyncio_concurrent(group="my_group")
85
+ async def test_groupB():
86
+ res = await wait_for_something_async()
87
+ assert result.is_valid()
88
+
89
+
90
+ Parametrized Tests
91
+
92
+ .. code-block:: python
93
+
94
+ # the parametrized tests below will run sequential
95
+ @pytest.mark.asyncio_concurrent
96
+ @pytest.parametrize("p", [0, 1, 2])
97
+ async def test_parametrize_sequential(p):
98
+ res = await wait_for_something_async()
99
+ assert result.is_valid()
100
+
101
+ # the parametrized tests below will run concurrently
102
+ @pytest.mark.asyncio_concurrent(group="my_group")
103
+ @pytest.parametrize("p", [0, 1, 2])
104
+ async def test_parametrize_concurrent():
105
+ res = await wait_for_something_async()
106
+ assert result.is_valid()
107
+
108
+
109
+ Contributing
110
+ ------------
111
+
112
+ Contributions are very welcome. Tests can be run with ``tox``, please ensure
113
+ the coverage at least stays the same before you submit a pull request.
114
+
115
+ License
116
+ -------
117
+
118
+ Distributed under the terms of the ``MIT`` license, "pytest-asyncio-concurrent" is free and open source software
@@ -0,0 +1,120 @@
1
+ [build-system]
2
+ requires = [
3
+ "setuptools>=61.0",
4
+ ]
5
+ build-backend = "setuptools.build_meta"
6
+
7
+ [project]
8
+ name = "pytest-asyncio-concurrent"
9
+ description = "Pytest plugin to execute python async tests concurrently."
10
+ version = "0.1.2"
11
+ readme = "README.rst"
12
+ requires-python = ">=3.8"
13
+ authors = [
14
+ { name = "Zane Chen", email = "czl970721@gmail.com" },
15
+ ]
16
+ maintainers = [
17
+ { name = "Zane Chen", email = "czl970721@gmail.com" },
18
+ ]
19
+ license = {file = "LICENSE"}
20
+ classifiers = [
21
+ "Framework :: Pytest",
22
+ "Development Status :: 4 - Beta",
23
+ "Intended Audience :: Developers",
24
+ "Topic :: Software Development :: Testing",
25
+ "Operating System :: OS Independent",
26
+ "Programming Language :: Python",
27
+ "Programming Language :: Python :: 3.8",
28
+ "Programming Language :: Python :: 3.9",
29
+ "Programming Language :: Python :: 3.10",
30
+ "Programming Language :: Python :: 3.11",
31
+ "Programming Language :: Python :: 3.12",
32
+ "Programming Language :: Python :: 3.13",
33
+ "Programming Language :: Python :: 3 :: Only",
34
+ "License :: OSI Approved :: MIT License",
35
+ ]
36
+ dependencies = [
37
+ "pytest>=6.2.0",
38
+ ]
39
+ optional-dependencies.testing = [
40
+ "coverage>=7.6.0",
41
+ ]
42
+ [project.urls]
43
+ Repository = "https://github.com/czl9707/pytest-asyncio-concurrent"
44
+ Homepage = "https://github.com/czl9707/pytest-asyncio-concurrent"
45
+ Issues = "https://github.com/czl9707/pytest-asyncio-concurrent/issues"
46
+
47
+ [project.entry-points.pytest11]
48
+ asyncio-concurrent = "pytest_asyncio_concurrent.plugin"
49
+
50
+ [tool.setuptools]
51
+ packages = [
52
+ "pytest_asyncio_concurrent",
53
+ ]
54
+ include-package-data = true
55
+ license-files = [
56
+ "LICENSE",
57
+ ]
58
+
59
+ [tool.black]
60
+ line-length = 100
61
+
62
+ [tool.flake8]
63
+ max-line-length = 100
64
+
65
+ [tool.pytest.ini_options]
66
+ asyncio_mode = "strict"
67
+ asyncio_default_fixture_loop_scope = "function"
68
+
69
+ [tool.coverage.run]
70
+ source = [
71
+ "pytest_asyncio_concurrent",
72
+ ]
73
+ branch = true
74
+ data_file = "coverage/coverage"
75
+ omit = [
76
+ "*/_version.py",
77
+ ]
78
+ parallel = true
79
+ concurrency = [
80
+ "multiprocessing"
81
+ ]
82
+
83
+ [tool.coverage.report]
84
+ show_missing = true
85
+
86
+ [tool.bumpversion]
87
+ current_version = "0.1.2"
88
+ parse = """(?x)
89
+ (?P<major>0|[1-9]\\d*)\\.
90
+ (?P<minor>0|[1-9]\\d*)\\.
91
+ (?P<patch>0|[1-9]\\d*)
92
+ (?:
93
+ -prerelease-(?P<pre>0|[1-9]\\d*)
94
+ )?
95
+ """
96
+ serialize = [
97
+ "{major}.{minor}.{patch}-prerelease-{pre}",
98
+ "{major}.{minor}.{patch}",
99
+ ]
100
+ search = "{current_version}"
101
+ replace = "{new_version}"
102
+ regex = false
103
+ ignore_missing_version = false
104
+ ignore_missing_files = false
105
+ tag = true
106
+ sign_tags = false
107
+ tag_name = "v{new_version}"
108
+ tag_message = "Bump version: {current_version} → {new_version}"
109
+ allow_dirty = false
110
+ commit = true
111
+ message = "Bump version: {current_version} → {new_version}"
112
+ commit_args = ""
113
+ setup_hooks = []
114
+ pre_commit_hooks = []
115
+ post_commit_hooks = []
116
+
117
+ [[tool.bumpversion.files]]
118
+ filename = "pyproject.toml"
119
+ search = "version = \"{current_version}\""
120
+ replace = "version = \"{new_version}\""
@@ -0,0 +1,8 @@
1
+ """The main point for importing pytest-asyncio-concurrent items."""
2
+
3
+ from typing import List
4
+ from .plugin import AsyncioConcurrentGroup
5
+
6
+ __all__: List[str] = [
7
+ AsyncioConcurrentGroup.__name__,
8
+ ]