File: keyboardinterrupt.py

package info (click to toggle)
nose 1.3.7-9
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,900 kB
  • sloc: python: 15,733; makefile: 99; xml: 42; sh: 2
file content (36 lines) | stat: -rw-r--r-- 773 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os

from tempfile import mktemp
from time import sleep

if 'NOSE_MP_LOG' not in os.environ:
    raise Exception('Environment variable NOSE_MP_LOG is not set')

logfile = os.environ['NOSE_MP_LOG']
killfile = os.environ['NOSE_MP_KILL']

def log(w):
    f = open(logfile, 'a')
    f.write(w+"\n")
    f.close()

def touch_killfile():
    f = open(killfile,'wb')
    f.close()

#make sure all tests in this file are dispatched to the same subprocess
def setup():
    log('setup')

def test_timeout():
    log('test_timeout')
    touch_killfile()
    sleep(2)
    log('test_timeout_finished')

# check timeout will not prevent remaining tests dispatched to the same subprocess to continue to run
def test_pass():
    log('test_pass')

def teardown():
    log('teardown')