eventbrite/pysoa

`stub_action` doesn't play nice with `side_effect`s that raise errors

Closed this issue · 0 comments

OS: macOS mojave 10.14.6 (18G2022)
Python: Python 3.7.6 (CPython)

stub_action seems to "cache" exceptions given through side_effect, effectively ignoring whatever values come next and re-raising the exception it encountered indefinitely.

STR:

  1. pip3 install pytest==5.3.5 pysoa==1.1.0
  2. python3
  3. Paste this code:
import pytest
from pysoa.client.client import Client
from pysoa.common.transport.errors import MessageReceiveTimeout
from pysoa.test.stub_service import stub_action


def test_it():
    client = Client(config={})
    with stub_action('foo', 'bar', side_effect=[MessageReceiveTimeout('foo'), {}]):
        with pytest.raises(MessageReceiveTimeout):
            client.call_action('foo', 'bar')
        client.call_action('foo', 'bar')


test_it()