uber/doubles

doubles 1.5.0 breaks automatic teardown of top-level expectations between test cases

jordanlibrande opened this issue · 2 comments

with doubles 1.4.0, the following test case passes:

file foo:

def bar(x):
    pass

file test_doubles:

from unittest import TestCase
import foo

class TestSomething(TestCase):

    def test_one(self):
        expect(foo).bar.with_args(1)
        foo.bar(1)

    def test_two(self):
        foo.bar(2)

With 1.5.0, it fails because the top-level expectation leaks between the tests.

______________________________________________ TestSomething.test_two ______________________________________________
test_doubles.py:27: in test_two
    foo.bar(2)
env/lib/python2.7/site-packages/doubles/proxy_method.py:75: in __call__
    self._raise_exception(args, kwargs)
env/lib/python2.7/site-packages/doubles/proxy_method.py:160: in _raise_exception
    build_argument_repr_string(args, kwargs)
E   UnallowedMethodCallError: Received unexpected call to 'bar' on <module 'foo' from '<path>/foo.py'>.  The supplied arguments (2) do not match any available allowances.
======================================== 1 failed, 1 passed in 1.08 seconds ========================================

This was caused by: 0900dc9

@toddsifleet can we release version 1.5.1?