Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #102408
| From | Chris Withers <chris@simplistix.co.uk> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | testfixtures 4.8.0 Released! |
| Date | 2016-02-02 15:44 +0000 |
| Message-ID | <mailman.17.1454428387.3032.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
testfixtures 4.8.0 Released! Chris Withers <chris@simplistix.co.uk> - 2016-02-02 15:44 +0000
csiph-web