def test_gotcha(self): # Just because you replace an object in one context, # doesn't meant that it's replaced in all contexts! def test_z(): return 'test z' compare(sample1.z(),'original z') compare(sample2.z(),'original z') @replace('testfixtures.tests.sample1.z',test_z) def test_something(): compare(sample1.z(),'test z') compare(sample2.z(),'original z') compare(sample1.z(),'original z') compare(sample2.z(),'original z') test_something() compare(sample1.z(),'original z') compare(sample2.z(),'original z')
def test_something(): compare(sample1.z(),'test z') compare(sample2.z(),'original z')
def test_something(): compare(sample1.z(), "test z") compare(sample2.z(), "original z")