Ejemplo n.º 1
0
class TestStepQueue(object):

    _DUMMY_PARALLEL_CNT = 9

    def setup_method(self):
        self._scenario_queue = StepQueue()

    def test_multi_proc_cnt(self):
        self._scenario_queue.multi_proc_cnt = self._DUMMY_PARALLEL_CNT
        assert self._scenario_queue.multi_proc_cnt == self._DUMMY_PARALLEL_CNT

    def test_push_and_pop(self):
        instance = "spam"
        self._scenario_queue.push(instance)
        ret = self._scenario_queue.pop()
        ret == "spam"

    def test_peek(self):
        instance = "spam"
        self._scenario_queue.push(instance)
        assert self._scenario_queue.peek() == "spam"

    def test_size(self):
        instance = "spam"
        self._scenario_queue.push(instance)
        size = self._scenario_queue.size()
        # remove test data in queue
        self._scenario_queue.pop()
        assert size == 1

    def test_is_empty(self):
        is_empty = self._scenario_queue.is_empty()
        assert is_empty is True
Ejemplo n.º 2
0
class TestScenairoQueue(object):
    def setup_method(self):
        self._scenario_queue = StepQueue()

    def test_push_and_pop(self):
        instance = "spam"
        self._scenario_queue.push(instance)
        ret = self._scenario_queue.pop()
        ret == "spam"

    def test_size(self):
        instance = "spam"
        self._scenario_queue.push(instance)
        size = self._scenario_queue.size()
        # remove test data in queue
        self._scenario_queue.pop()
        assert size == 1

    def test_is_empty(self):
        is_empty = self._scenario_queue.is_empty()
        assert is_empty is True