Revise develop-docs: functional test example
@@ -78,11 +78,14 @@ The test suite contains three kinds of tests
These are rare and mostly for testing the command line interface.
If you are comfortable with the Tornado interface then you will be happiest
-using the ``@gen_cluster`` style of test
+using the ``@gen_cluster`` style of test, e.g.
.. code-block:: python
- from distributed.utils_test import gen_cluster
+ # tests/test_submit.py
+
+ from distributed.utils_test import gen_cluster, inc
+ from distributed import Client, Future, Scheduler, Worker
@gen_cluster(client=True)
def test_submit(c, s, a, b):
@@ -92,6 +95,7 @@ using the ``@gen_cluster`` style of test
assert isinstance(b, Worker)
future = c.submit(inc, 1)
+ assert isinstance(future, Future)
assert future.key in c.futures
# result = future.result() # This synchronous API call would block
@@ -101,6 +105,7 @@ using the ``@gen_cluster`` style of test
assert future.key in s.tasks
assert future.key in a.data or future.key in b.data
+
The ``@gen_cluster`` decorator sets up a scheduler, client, and workers for
you and cleans them up after the test. It also allows you to directly inspect
the state of every element of the cluster directly. However, you can not use
