diff --git a/tests/test_local.py b/tests/test_local.py index 2344f5f..3f41301 100644 --- a/tests/test_local.py +++ b/tests/test_local.py @@ -8,6 +8,9 @@ import trio import tractor +from conftest import tractor_test + + @pytest.mark.trio async def test_no_arbitter(): """An arbitter must be established before any nurseries @@ -21,6 +24,13 @@ async def test_no_arbitter(): pass +def test_no_main(): + """An async function **must** be passed to ``tractor.run()``. + """ + with pytest.raises(TypeError): + tractor.run(None) + + def test_local_actor_async_func(arb_addr): """Verify a simple async function in-process. """ diff --git a/tractor/__init__.py b/tractor/__init__.py index eccd5f7..d48e257 100644 --- a/tractor/__init__.py +++ b/tractor/__init__.py @@ -43,7 +43,7 @@ async def _main( """Async entry point for ``tractor``. """ log = get_logger('tractor') - main = partial(async_fn, *args) if async_fn else None + main = partial(async_fn, *args) arbiter_addr = (host, port) = arbiter_addr or ( _default_arbiter_host, _default_arbiter_port) get_console_log(kwargs.get('loglevel', get_loglevel()))