[TIP] testfixtures 4.8.0 Released!

Chris Withers chris at simplistix.co.uk
Tue Feb 2 07:44:20 PST 2016


Hi All,

I'm pleased to announce the release of testfixtures 4.8.0 featuring the 
following:

- More succinct mocking with Replacer:

For setUp usage:

class MyTests(TestCase):

     def setUp(self):
         replace = Replacer()
         replace('x.y.z', Mock())
         self.addCleanup(replace.restore)

For one-shot context manager usage:

with Replace('x.y.z', Mock()) as the_mock:
     ...

Multi-replace context manager usage:

with Replacer() as replace:
     dt = replace('x.y.z.datetime', test_datetime())
     mock = replace('x.y.do_it', Mock())

- Two context managers for testing warnings:

with ShouldWarn(UserWarning("foo")):
     warnings.warn('foo')

with ShouldNotWarn():
     ... code that should raise no warnings ...

The package is on PyPI and a full list of all the links to docs, issue 
trackers and the like can be found here:

https://github.com/Simplistix/testfixtures

Any questions, please do ask on the Testing in Python list or on the 
Simplistix open source mailing list...

cheers,

Chris

-- 
Simplistix - Content Management, Batch Processing & Python Consulting
            - http://www.simplistix.co.uk



More information about the testing-in-python mailing list