Ejemplo n.º 1
0
def test_join(MockABC, simple_config):
    # Tests join, stop_and_join and is_alive
    s = Server(simple_config)
    assert s.is_alive() is True

    joining_thread = threading.Thread(target=s.join)
    joining_thread.start()

    # The server should still be running...
    time.sleep(0.05)
    assert joining_thread.is_alive()
    assert s.is_alive() is True

    # When server is stopped, the joining thread should be complete
    s.stop_and_join()
    assert s.is_alive() is False
    joining_thread.join()