summaryrefslogtreecommitdiff
path: root/plac/doc/test_runp.py
diff options
context:
space:
mode:
Diffstat (limited to 'plac/doc/test_runp.py')
-rw-r--r--plac/doc/test_runp.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/plac/doc/test_runp.py b/plac/doc/test_runp.py
new file mode 100644
index 0000000..65980f8
--- /dev/null
+++ b/plac/doc/test_runp.py
@@ -0,0 +1,26 @@
+"""
+This test should work on Linux if you have both Tkinter installed.
+"""
+
+from __future__ import with_statement
+import plac, plac_tk, time
+
+def gen(n):
+ for i in range(n):
+ yield str(i)
+ time.sleep(.1)
+
+def test():
+ tasks = plac.runp([gen(3), gen(5), gen(10)])
+ for t in tasks:
+ t.result
+
+def test_tkmonitor():
+ mon = plac_tk.TkMonitor('tkmon')
+ i = plac.Interpreter.from_gen([gen(3), gen(5), gen(10)], 'p', [mon])
+ with i:
+ for t in i.tasks():
+ t.run()
+ for t in i.tasks():
+ t.result
+ i.man.stop()