File: test_runp.py

package info (click to toggle)
python-plac 1.4.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 620 kB
  • sloc: python: 2,185; lisp: 57; makefile: 30; sh: 20
file content (22 lines) | stat: -rw-r--r-- 447 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""
This test should work on Linux if you have Tkinter installed.
"""

from __future__ import with_statement
import plac, time

def gen(n):
    for i in range(n + 1):
        yield str(i)
        time.sleep(.1)

def err():
    yield 1/0

def test1():
    assert ['3', '5', '10'] == plac.runp([gen(3), gen(5), gen(10)])

def test2():
    result, error = plac.runp([gen(3), err()])
    assert result == '3' and error.__class__ == ZeroDivisionError