pytest-asyncio-concurrent 0.2.1__tar.gz → 0.2.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.
- {pytest_asyncio_concurrent-0.2.1/pytest_asyncio_concurrent.egg-info → pytest_asyncio_concurrent-0.2.2}/PKG-INFO +2 -2
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/pyproject.toml +2 -2
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/pytest_asyncio_concurrent/plugin.py +69 -11
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2/pytest_asyncio_concurrent.egg-info}/PKG-INFO +2 -2
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/LICENSE +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/README.rst +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/pytest_asyncio_concurrent/__init__.py +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/pytest_asyncio_concurrent/fixture_async.py +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/pytest_asyncio_concurrent/grouping.py +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/pytest_asyncio_concurrent/hooks.py +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/pytest_asyncio_concurrent.egg-info/SOURCES.txt +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/pytest_asyncio_concurrent.egg-info/dependency_links.txt +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/pytest_asyncio_concurrent.egg-info/entry_points.txt +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/pytest_asyncio_concurrent.egg-info/requires.txt +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/pytest_asyncio_concurrent.egg-info/top_level.txt +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/setup.cfg +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/tests/test_async_fixture.py +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/tests/test_compatibility.py +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/tests/test_error.py +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/tests/test_fixture_lifecycle.py +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/tests/test_fixture_scoping.py +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/tests/test_grouping.py +0 -0
- {pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/tests/test_status.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: pytest-asyncio-concurrent
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
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>
|
|
@@ -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.2"
|
|
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.2"
|
|
88
88
|
parse = """(?x)
|
|
89
89
|
(?P<major>0|[1-9]\\d*)\\.
|
|
90
90
|
(?P<minor>0|[1-9]\\d*)\\.
|
|
@@ -4,6 +4,7 @@ import inspect
|
|
|
4
4
|
import uuid
|
|
5
5
|
import warnings
|
|
6
6
|
import sys
|
|
7
|
+
import contextlib
|
|
7
8
|
|
|
8
9
|
from typing import (
|
|
9
10
|
Any,
|
|
@@ -16,12 +17,13 @@ from typing import (
|
|
|
16
17
|
Dict,
|
|
17
18
|
Sequence,
|
|
18
19
|
Union,
|
|
20
|
+
ContextManager,
|
|
19
21
|
)
|
|
20
22
|
|
|
23
|
+
import pluggy
|
|
21
24
|
import pytest
|
|
22
25
|
from _pytest import timing
|
|
23
26
|
from _pytest import outcomes
|
|
24
|
-
from _pytest import warnings as pytest_warnings
|
|
25
27
|
|
|
26
28
|
from .grouping import (
|
|
27
29
|
AsyncioConcurrentGroup,
|
|
@@ -202,7 +204,7 @@ def pytest_runtest_protocol_async_group(
|
|
|
202
204
|
item_passed_setup.append(childFunc)
|
|
203
205
|
|
|
204
206
|
for childFunc in item_passed_setup:
|
|
205
|
-
coros.append(_call_and_report_runtest_async(childFunc
|
|
207
|
+
coros.append(_call_and_report_runtest_async(childFunc))
|
|
206
208
|
|
|
207
209
|
loop.run_until_complete(asyncio.gather(*coros))
|
|
208
210
|
|
|
@@ -216,9 +218,7 @@ def pytest_runtest_protocol_async_group(
|
|
|
216
218
|
return True
|
|
217
219
|
|
|
218
220
|
|
|
219
|
-
async def _call_and_report_runtest_async(
|
|
220
|
-
item: AsyncioConcurrentGroupMember, nextgroup: Optional[AsyncioConcurrentGroup]
|
|
221
|
-
) -> None:
|
|
221
|
+
async def _call_and_report_runtest_async(item: AsyncioConcurrentGroupMember) -> None:
|
|
222
222
|
callinfo = await _async_callinfo_from_call(
|
|
223
223
|
functools.partial(item.ihook.pytest_runtest_call_async, item=item) # type: ignore
|
|
224
224
|
)
|
|
@@ -362,18 +362,54 @@ def pytest_runtest_teardown_handle_async_function(
|
|
|
362
362
|
item.group.teardown_child(item)
|
|
363
363
|
|
|
364
364
|
|
|
365
|
-
# =========================== #
|
|
365
|
+
# =========================== # Captures #===========================#
|
|
366
366
|
|
|
367
367
|
|
|
368
368
|
@pytest.hookimpl(specname="pytest_runtest_protocol_async_group", wrapper=True, tryfirst=True)
|
|
369
369
|
def pytest_runtest_protocol_async_group_warning(
|
|
370
370
|
group: "AsyncioConcurrentGroup", nextgroup: Optional["AsyncioConcurrentGroup"]
|
|
371
371
|
) -> Generator[None, object, object]:
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
372
|
+
with_pytest_runtest_protocol_warning = _with_specific_hook_wrapped(
|
|
373
|
+
group.ihook.pytest_runtest_protocol, "warnings"
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
if with_pytest_runtest_protocol_warning:
|
|
377
|
+
with with_pytest_runtest_protocol_warning(item=group, nextitem=nextgroup):
|
|
378
|
+
result = yield
|
|
379
|
+
|
|
380
|
+
return result
|
|
381
|
+
|
|
382
|
+
return (yield)
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
@pytest.hookimpl(specname="pytest_runtest_call_async", wrapper=True, tryfirst=True)
|
|
386
|
+
def pytest_runtest_call_async_logging(item: pytest.Item) -> Generator[None, object, object]:
|
|
387
|
+
with_pytest_runtest_call_logging = _with_specific_hook_wrapped(
|
|
388
|
+
item.ihook.pytest_runtest_call, "logging-plugin"
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
if with_pytest_runtest_call_logging:
|
|
392
|
+
with with_pytest_runtest_call_logging(item=item):
|
|
393
|
+
result = yield
|
|
394
|
+
|
|
395
|
+
return result
|
|
396
|
+
|
|
397
|
+
return (yield)
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
@pytest.hookimpl(specname="pytest_runtest_call_async", wrapper=True, tryfirst=True)
|
|
401
|
+
def pytest_runtest_call_async_capture(item: pytest.Item) -> Generator[None, object, object]:
|
|
402
|
+
with_pytest_runtest_call_capture = _with_specific_hook_wrapped(
|
|
403
|
+
item.ihook.pytest_runtest_call, "capturemanager"
|
|
404
|
+
)
|
|
405
|
+
|
|
406
|
+
if with_pytest_runtest_call_capture:
|
|
407
|
+
with with_pytest_runtest_call_capture(item=item):
|
|
408
|
+
result = yield
|
|
409
|
+
|
|
410
|
+
return result
|
|
411
|
+
|
|
412
|
+
return (yield)
|
|
377
413
|
|
|
378
414
|
|
|
379
415
|
# =========================== # helper #===========================#
|
|
@@ -443,3 +479,25 @@ def _call_and_report(
|
|
|
443
479
|
):
|
|
444
480
|
item.ihook.pytest_exception_interact(node=item, call=call, report=report)
|
|
445
481
|
return report
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
def _with_specific_hook_wrapped(
|
|
485
|
+
hook: pluggy.HookCaller,
|
|
486
|
+
plugin: str,
|
|
487
|
+
) -> Optional[Callable[..., ContextManager]]:
|
|
488
|
+
try:
|
|
489
|
+
hookimpl = next(h for h in hook.get_hookimpls() if h.plugin_name == plugin)
|
|
490
|
+
except StopIteration:
|
|
491
|
+
return None
|
|
492
|
+
|
|
493
|
+
@contextlib.contextmanager
|
|
494
|
+
def cm(**kwargs: Dict) -> Generator:
|
|
495
|
+
gen = hookimpl.function(**{k: v for k, v in kwargs.items() if k in hookimpl.argnames})
|
|
496
|
+
next(gen) # type: ignore
|
|
497
|
+
yield
|
|
498
|
+
try:
|
|
499
|
+
next(gen) # type: ignore
|
|
500
|
+
except StopIteration:
|
|
501
|
+
pass
|
|
502
|
+
|
|
503
|
+
return cm
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: pytest-asyncio-concurrent
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
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>
|
|
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
|
|
File without changes
|
{pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/tests/test_async_fixture.py
RENAMED
|
File without changes
|
{pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/tests/test_compatibility.py
RENAMED
|
File without changes
|
|
File without changes
|
{pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/tests/test_fixture_lifecycle.py
RENAMED
|
File without changes
|
{pytest_asyncio_concurrent-0.2.1 → pytest_asyncio_concurrent-0.2.2}/tests/test_fixture_scoping.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|