Esempio n. 1
0
    def test_halt_group_when_stopped(self):
        for n in range(1, 4):
            tps = [Transport(worker_class=Worker) for i in range(n)]
            g = Group(*tps)
            assert_group_stopped(g, tps)

            g.halt()
            assert_group_stopped(g, tps)
Esempio n. 2
0
    def test_halt_when_transport_stopped(self):
        for n in range(1, 4):
            tps = [Transport() for i in range(n)]
            g = Group(*tps)
            assert_group_stopped(g, tps)

            g.start()
            assert_group_running(g, tps)

            for tp in tps:
                tp.stop()

            g.halt()
            assert_group_stopped(g, tps)
Esempio n. 3
0
    def test_halt_group_doesnt_do_work(self):
        for n in range(1, 4):
            tps = [Transport(worker_class=Worker) for i in range(n)]
            g = Group(*tps)
            assert_group_stopped(g, tps)

            g.start()
            assert_group_running(g, tps)

            for tp in tps:
                expect_json = tjson()
                tp.queue.put(expect_json, True, None)
                assert len(tp.queue) == 1

            g.halt()
            assert_group_stopped(g, tps)
            for tp in tps:
                assert len(tp.queue) == 1, 'exp no work on call to halt'