Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/manuels/nose-deadline

Enforced timelimits for nosetests
https://github.com/manuels/nose-deadline

Last synced: about 2 months ago
JSON representation

Enforced timelimits for nosetests

Awesome Lists containing this project

README

        

# nose-deadline

## Description
Enforced timelimits for nosetests.

## Example

from nose_deadline import deadline

@deadline(1)
def test_sleep():
import time
time.sleep(5)

Then run `nosetest --with-deadline ` and you will see this error message:

T
======================================================================
Deadline exceeded.: test.test_sleep
----------------------------------------------------------------------
Traceback (most recent call last):
[...]
File "test.py", line 6, in test_sleep
time.sleep(5)
File "/home/schoellingm/tmp/nose-alarm/nose_deadline.py", line 19, in sig_handler
raise DeadlineExceeded('Test did not finish within {}sec.'.format(sec))
nose_deadline.DeadlineExceeded: Test did not finish within 1sec.

----------------------------------------------------------------------
Ran 1 test in 1.001s

FAILED (Deadline exceeded.=1)

## Restrictions
Only works on *nix systems because it needs POSIX signals.