pytest-asyncio-concurrent 0.2.2__tar.gz → 0.2.3__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.
- {pytest_asyncio_concurrent-0.2.2/pytest_asyncio_concurrent.egg-info → pytest_asyncio_concurrent-0.2.3}/PKG-INFO +4 -3
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/README.rst +3 -2
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/pyproject.toml +2 -2
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/pytest_asyncio_concurrent/plugin.py +10 -3
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3/pytest_asyncio_concurrent.egg-info}/PKG-INFO +4 -3
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/tests/test_status.py +48 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/LICENSE +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/pytest_asyncio_concurrent/__init__.py +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/pytest_asyncio_concurrent/fixture_async.py +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/pytest_asyncio_concurrent/grouping.py +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/pytest_asyncio_concurrent/hooks.py +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/pytest_asyncio_concurrent.egg-info/SOURCES.txt +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/pytest_asyncio_concurrent.egg-info/dependency_links.txt +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/pytest_asyncio_concurrent.egg-info/entry_points.txt +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/pytest_asyncio_concurrent.egg-info/requires.txt +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/pytest_asyncio_concurrent.egg-info/top_level.txt +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/setup.cfg +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/tests/test_async_fixture.py +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/tests/test_compatibility.py +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/tests/test_error.py +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/tests/test_fixture_lifecycle.py +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/tests/test_fixture_scoping.py +0 -0
- {pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/tests/test_grouping.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: pytest-asyncio-concurrent
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Pytest plugin to execute python async tests concurrently.
|
|
5
5
|
Author-email: Zane Chen <czl970721@gmail.com>
|
|
6
6
|
Maintainer-email: Zane Chen <czl970721@gmail.com>
|
|
@@ -88,7 +88,7 @@ Key Features
|
|
|
88
88
|
* Providing granular control over Concurrency
|
|
89
89
|
|
|
90
90
|
* Specifying Async Group to control tests that can run together.
|
|
91
|
-
* Specifying Timeout to avoid async tests taking forever.
|
|
91
|
+
* Specifying Timeout to avoid async tests taking forever.
|
|
92
92
|
|
|
93
93
|
* Compatible with ``pytest-asyncio``.
|
|
94
94
|
|
|
@@ -146,7 +146,8 @@ Run tests Concurrently
|
|
|
146
146
|
res = await wait_for_something_async()
|
|
147
147
|
assert result.is_valid()
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
# this one will have a 10s timeout
|
|
150
|
+
@pytest.mark.asyncio_concurrent(group="my_group", timeout=10)
|
|
150
151
|
async def test_groupB():
|
|
151
152
|
res = await wait_for_something_async()
|
|
152
153
|
assert result.is_valid()
|
|
@@ -35,7 +35,7 @@ Key Features
|
|
|
35
35
|
* Providing granular control over Concurrency
|
|
36
36
|
|
|
37
37
|
* Specifying Async Group to control tests that can run together.
|
|
38
|
-
* Specifying Timeout to avoid async tests taking forever.
|
|
38
|
+
* Specifying Timeout to avoid async tests taking forever.
|
|
39
39
|
|
|
40
40
|
* Compatible with ``pytest-asyncio``.
|
|
41
41
|
|
|
@@ -93,7 +93,8 @@ Run tests Concurrently
|
|
|
93
93
|
res = await wait_for_something_async()
|
|
94
94
|
assert result.is_valid()
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
# this one will have a 10s timeout
|
|
97
|
+
@pytest.mark.asyncio_concurrent(group="my_group", timeout=10)
|
|
97
98
|
async def test_groupB():
|
|
98
99
|
res = await wait_for_something_async()
|
|
99
100
|
assert result.is_valid()
|
|
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "pytest-asyncio-concurrent"
|
|
9
9
|
description = "Pytest plugin to execute python async tests concurrently."
|
|
10
|
-
version = "0.2.
|
|
10
|
+
version = "0.2.3"
|
|
11
11
|
readme = "README.rst"
|
|
12
12
|
requires-python = ">=3.8"
|
|
13
13
|
authors = [
|
|
@@ -84,7 +84,7 @@ concurrency = [
|
|
|
84
84
|
show_missing = true
|
|
85
85
|
|
|
86
86
|
[tool.bumpversion]
|
|
87
|
-
current_version = "0.2.
|
|
87
|
+
current_version = "0.2.3"
|
|
88
88
|
parse = """(?x)
|
|
89
89
|
(?P<major>0|[1-9]\\d*)\\.
|
|
90
90
|
(?P<minor>0|[1-9]\\d*)\\.
|
|
@@ -219,8 +219,13 @@ def pytest_runtest_protocol_async_group(
|
|
|
219
219
|
|
|
220
220
|
|
|
221
221
|
async def _call_and_report_runtest_async(item: AsyncioConcurrentGroupMember) -> None:
|
|
222
|
+
mark = _get_asyncio_concurrent_mark(item)
|
|
223
|
+
assert mark
|
|
224
|
+
timeout = mark.kwargs.get("timeout")
|
|
225
|
+
|
|
222
226
|
callinfo = await _async_callinfo_from_call(
|
|
223
|
-
functools.partial(item.ihook.pytest_runtest_call_async, item=item) # type: ignore
|
|
227
|
+
functools.partial(item.ihook.pytest_runtest_call_async, item=item), # type: ignore
|
|
228
|
+
timeout=timeout,
|
|
224
229
|
)
|
|
225
230
|
report = item.ihook.pytest_runtest_makereport(item=item, call=callinfo)
|
|
226
231
|
item.ihook.pytest_runtest_logreport(report=report)
|
|
@@ -427,14 +432,16 @@ def _get_asyncio_concurrent_group(item: pytest.Item) -> str:
|
|
|
427
432
|
|
|
428
433
|
|
|
429
434
|
# referencing CallInfo.from_call
|
|
430
|
-
async def _async_callinfo_from_call(
|
|
435
|
+
async def _async_callinfo_from_call(
|
|
436
|
+
func: Callable[[], Coroutine], timeout: Optional[int]
|
|
437
|
+
) -> pytest.CallInfo:
|
|
431
438
|
"""An async version of CallInfo.from_call"""
|
|
432
439
|
|
|
433
440
|
excinfo = None
|
|
434
441
|
start = timing.time()
|
|
435
442
|
precise_start = timing.perf_counter()
|
|
436
443
|
try:
|
|
437
|
-
result = await func()
|
|
444
|
+
result = await asyncio.wait_for(func(), timeout=timeout)
|
|
438
445
|
except BaseException:
|
|
439
446
|
excinfo = pytest.ExceptionInfo.from_current()
|
|
440
447
|
if isinstance(excinfo.value, outcomes.Exit) or isinstance(excinfo.value, KeyboardInterrupt):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: pytest-asyncio-concurrent
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: Pytest plugin to execute python async tests concurrently.
|
|
5
5
|
Author-email: Zane Chen <czl970721@gmail.com>
|
|
6
6
|
Maintainer-email: Zane Chen <czl970721@gmail.com>
|
|
@@ -88,7 +88,7 @@ Key Features
|
|
|
88
88
|
* Providing granular control over Concurrency
|
|
89
89
|
|
|
90
90
|
* Specifying Async Group to control tests that can run together.
|
|
91
|
-
* Specifying Timeout to avoid async tests taking forever.
|
|
91
|
+
* Specifying Timeout to avoid async tests taking forever.
|
|
92
92
|
|
|
93
93
|
* Compatible with ``pytest-asyncio``.
|
|
94
94
|
|
|
@@ -146,7 +146,8 @@ Run tests Concurrently
|
|
|
146
146
|
res = await wait_for_something_async()
|
|
147
147
|
assert result.is_valid()
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
# this one will have a 10s timeout
|
|
150
|
+
@pytest.mark.asyncio_concurrent(group="my_group", timeout=10)
|
|
150
151
|
async def test_groupB():
|
|
151
152
|
res = await wait_for_something_async()
|
|
152
153
|
assert result.is_valid()
|
|
@@ -238,3 +238,51 @@ def test_cmd_select(pytester: pytest.Pytester):
|
|
|
238
238
|
result = pytester.runpytest("test_dummy.py::test_cmd_select_A")
|
|
239
239
|
|
|
240
240
|
result.assert_outcomes(passed=1)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
def test_timeout_seperate(pytester: pytest.Pytester):
|
|
244
|
+
"""Make sure tests got skipped if synced tests got marked"""
|
|
245
|
+
|
|
246
|
+
pytester.makepyfile(
|
|
247
|
+
dedent(
|
|
248
|
+
"""\
|
|
249
|
+
import asyncio
|
|
250
|
+
import pytest
|
|
251
|
+
|
|
252
|
+
@pytest.mark.asyncio_concurrent(timeout=0.2)
|
|
253
|
+
async def test_timeout_seperateA():
|
|
254
|
+
await asycio.sleep(0.3)
|
|
255
|
+
|
|
256
|
+
@pytest.mark.asyncio_concurrent(timeout=0.1)
|
|
257
|
+
async def test_timeout_seperateB():
|
|
258
|
+
await asycio.sleep(0.2)
|
|
259
|
+
"""
|
|
260
|
+
)
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
result = pytester.runpytest()
|
|
264
|
+
result.assert_outcomes(failed=2)
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
def test_timeout_concurrent(pytester: pytest.Pytester):
|
|
268
|
+
"""Make sure tests got skipped if synced tests got marked"""
|
|
269
|
+
|
|
270
|
+
pytester.makepyfile(
|
|
271
|
+
dedent(
|
|
272
|
+
"""\
|
|
273
|
+
import asyncio
|
|
274
|
+
import pytest
|
|
275
|
+
|
|
276
|
+
@pytest.mark.asyncio_concurrent(group="a", timeout=0.2)
|
|
277
|
+
async def test_timeout_concurrentA():
|
|
278
|
+
await asycio.sleep(0.3)
|
|
279
|
+
|
|
280
|
+
@pytest.mark.asyncio_concurrent(group="a", timeout=0.1)
|
|
281
|
+
async def test_timeout_concurrentB():
|
|
282
|
+
await asycio.sleep(0.2)
|
|
283
|
+
"""
|
|
284
|
+
)
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
result = pytester.runpytest()
|
|
288
|
+
result.assert_outcomes(failed=2)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/tests/test_async_fixture.py
RENAMED
|
File without changes
|
{pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/tests/test_compatibility.py
RENAMED
|
File without changes
|
|
File without changes
|
{pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/tests/test_fixture_lifecycle.py
RENAMED
|
File without changes
|
{pytest_asyncio_concurrent-0.2.2 → pytest_asyncio_concurrent-0.2.3}/tests/test_fixture_scoping.py
RENAMED
|
File without changes
|
|
File without changes
|