B _` @sdZddgZddlZddlZddlmZyddlmZdZWn.e k rTdZYne k rjdZYnXGd dde Z Gd ddeZ dS) zThis module defines a nose plugin to terminate a test after a specified number of seconds. Use the following command-line option with nosetests :: nosetests --test-timeout=### Timeout TestTimeoutN)Plugin)ProcessTFc@s eZdZdS)rN)__name__ __module__ __qualname__r r |}d}x,|t|kr8|||||d7}qW|S)Nr)Z get_childrenlenextend _all_children)rpZansir r r r(;s  zTestTimeout._all_childrencCsx4|ttD]}y |WqYqXqWt|jd}t|jd|d}|jd}d}|rd||dkr|dp~df}|r|r|d7}|d||dkrdpdf7}|r|r|d7}|d ||dkrdpdf7}td |dS) Ni<z %d hour%sr%sz, z %d minute%sz %d second%szTest exceeded timeout (%s))r(rosgetpidkillrr r)rsignumframer)hourminsectxtr r r r Cs(   zTestTimeout._killTestN) rrr__doc__nameZscorerrr#r$r(r r r r r rs )r7__all__r.rZnose.plugins.baserZpsutilrrrNotImplementedError Exceptionrrr r r r s