diff options
Diffstat (limited to 'functional_tests/test_multiprocessing/support/keyboardinterrupt_twice.py')
-rw-r--r-- | functional_tests/test_multiprocessing/support/keyboardinterrupt_twice.py | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/functional_tests/test_multiprocessing/support/keyboardinterrupt_twice.py b/functional_tests/test_multiprocessing/support/keyboardinterrupt_twice.py new file mode 100644 index 0000000..3932bbd --- /dev/null +++ b/functional_tests/test_multiprocessing/support/keyboardinterrupt_twice.py @@ -0,0 +1,34 @@ +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'] + +def log(w): + f = open(logfile, 'a') + f.write(w+"\n") + f.close() +#make sure all tests in this file are dispatched to the same subprocess +def setup(): + '''global logfile + logfile = mktemp() + print "tempfile is:",logfile''' + log('setup') + +def test_timeout(): + log('test_timeout') + 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') + sleep(10) + log('teardown_finished') |