Пример #1
0
def test_stop_fetch():
    """ Test that Fetch can be started and stopped correctly. """
    import queue, threading
    iq = queue.Queue()
    iq.put('http://nonexistant')
    f = Fetch(url_queue=iq, url_store=dict(), url_lock=threading.Lock())
    eq_(f.isAlive(), False)
    f.start()
    eq_(f.isAlive(), True)
    eq_(f._force_ending, False)
    f.stop()
    eq_(f._force_ending, True)
    f.join()
    eq_(f.isAlive(), False)