summaryrefslogtreecommitdiff
path: root/plac/doc/test_runp.py
blob: 619fc1fcb6d868305e911ab6b9aa6c29aa05b041 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""
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
    t.man.stop()

def test_tkmonitor():
    mon = plac_tk.TkMonitor('tkmon')
    tasks = plac.runp([gen(3), gen(5), gen(10)], monitors=[mon])
    for t in tasks:
        t.result
    t.man.stop()