testfixtures 4.8.0 Released!

3 views
Skip to first unread message

Chris Withers

unread,
Feb 2, 2016, 10:44:22 AM2/2/16
to testing-...@lists.idyll.org, Python List, simpl...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages