def test_shutdown(self):
        program = """\
import threading, sys

from crochet._shutdown import register, _watchdog
_watchdog.start()

end = False

def thread():
    while not end:
        pass
    sys.stdout.write("byebye")
    sys.stdout.flush()

def stop(x, y):
    # Move this into separate test at some point.
    assert x == 1
    assert y == 2
    global end
    end = True

threading.Thread(target=thread).start()
register(stop, 1, y=2)

sys.exit()
"""
        process = subprocess.Popen([sys.executable, "-c", program],
                                   cwd=crochet_directory,
                                   stdout=subprocess.PIPE)
        result = process.stdout.read()
        self.assertEqual(process.wait(), 0)
        self.assertEqual(result, b"byebye")
Record and process a learner's response to a card.
dataset/ETHPy150Open itamarst/crochet/crochet/tests/test_shutdown.py/ShutdownTests.test_shutdown--crossover with--dataset/ETHPy150Open heiskr/sagefy/server/routes/card.py/respond_to_card_route