Util Asynctestcase¶
Adds support for test cases which need to be run in an event loop.
Also contains a class integration tests can derive from. The integration tests can declare which of the plugins (that are a part of the main repo) they require to run. The test will be skipped if the plugin isn’t installed in development mode.
To install all plugins in development mode $ dffml service dev install
Add the -user flag to install to ~/.local
- class dffml.util.asynctestcase.AsyncTestCase(methodName='runTest')[source]¶
Runs any
test_
methods as coroutines in the default event loop.Examples
>>> import asyncio >>> from dffml import AsyncTestCase >>> >>> class AsyncTestCase(AsyncTestCase): ... async def test_sleep(self): ... await asyncio.sleep(1)
- async_wrapper(coro)[source]¶
Returns a function which calls the
test_
function which callsloop.run_until_complete
to return the result of the test.
- dffml.util.asynctestcase.non_existant_tempfile()[source]¶
Yield the filename of a non-existant file within a temporary directory