Testing¶
-
qtrio.
host
(func: typing.Callable[…, typing.Awaitable[object]]) → typing.Callable[…, object][source]¶ -
qtrio.
host
(*, timeout: float = '20', clock: trio.abc.Clock = 'None') → typing.Callable[[typing.Callable[…, typing.Awaitable[object]]], typing.Callable[…, object]] Decorate your tests that you want run in a Trio guest and a Qt Host. This decorator can be used in any of the following forms. Positional arguments other than a call with only the test function are not supported.
import qtrio @qtrio.host async def test_no_parentheses(request): assert True @qtrio.host() async def test_just_parentheses(request): assert True @qtrio.host(timeout=20) async def test_a_keyword_argument(request): assert True
Note
Presently the test is required to specify the
request
fixture so this decorator can intercept and use it.Warning
The interface for specifying tests to run in this way will likely change a lot. Try to keep up.
:|
- Parameters
func (
Callable
[…,Awaitable
[object
]]) – The test function to be run via QTrio.timeout (
float
) – The timeout to be applied to the test viatrio.move_on_after()
.clock (
Optional
[Clock
]) – Usually used to speed up tests viatrio.testing.MockClock
. Seetrio.lowlevel.start_guest_run()
.
- Return type
None