<s> from __future__ import ( absolute_import , division , generators , nested_scopes , print_function , <EOL> unicode_literals , with_statement ) <EOL> import threading <EOL> import unittest <EOL> from pants . base . worker_pool import Work , WorkerPool <EOL> from pants . base . workunit import WorkUnit <EOL> from pants . util . contextutil import temporary_dir <EOL> class FakeRunTracker ( object ) : <EOL> def register_thread ( self , one ) : <EOL> pass <EOL> def keyboard_interrupt_raiser ( ) : <EOL> raise KeyboardInterrupt ( ) <EOL> class WorkerPoolTest ( unittest . TestCase ) : <EOL> def test_keyboard_interrupts_propagated ( self ) : <EOL> condition = threading . Condition ( ) <EOL> condition . acquire ( ) <EOL> with self . assertRaises ( KeyboardInterrupt ) : <EOL> with temporary_dir ( ) as rundir : <EOL> pool = WorkerPool ( WorkUnit ( rundir , None , "<STR_LIT>" ) , FakeRunTracker ( ) , <NUM_LIT:1> ) <EOL> try : <EOL> pool . submit_async_work ( Work ( keyboard_interrupt_raiser , [ ( ) ] ) ) <EOL> condition . wait ( <NUM_LIT:2> ) <EOL> finally : <EOL> pool . abort ( ) </s>
