mock 0.8 release candidate 1 and handling mutable arguments
I've released mock 0.8 release candidate 1. You can download it it or install it with: pip install -U mock==dev mock is a library for testing in Python. ... [613 words]
View ArticleSphinx doctests and the execution namespace
I've finally started work on the documentation for mock 0.8 release, and much of it involves converting the write-ups I did in the blog entries. The mock documentation is built with the excellent...
View ArticlePython on Google Plus
As you may (or perhaps not) have noticed, I've been blogging a lot less in the last year. A new job with Canonical (although I've been there over a year now) and an eight month old daughter all make...
View Articlemock 0.8rc2: new release and development docs
I've pushed out a new release of mock. This fixes an inconsistency in the create_autospec api I discovered whilst working on the docs (yes I've really been working on the docs), and a fix for a bug...
View ArticleMocks with some attributes not present
Mock objects, from the mock library, create attributes on demand. This allows them to pretend to be objects of any type. ... [199 words]
View ArticleSimple mocking of open as a context manager
Using open as a context manager is a great way to ensure your file handles are closed properly and is becoming common: with open('/some/path', 'w') as f: f.write('something') The issue is that even if...
View ArticleCallable object with state using generators
It's often convenient to create callable objects that maintain some kind of state. In Python we can do this with objects that implement the __call__ method and store the state as instance attributes....
View Articlemock 0.8 released
After more than six months development work mock 0.8 has been released. 0.8 is a big release with many new features, general improvements and bugfixes. ... [968 words]
View ArticleTests that fail one day every four years
Some code looks harmless but has hidden bugs lurking in its nether regions. Code that handles dates is notorious for this, and this being February 29th (the coders' halloween) it's time for the bugs to...
View ArticleErgonomics: Kinesis Freestyle Keyboard and Evoluent Vertical Mouse
I've been using computers for a long time, and for most of that time I've been using them for the whole of the working day and often the rest of the day too. A few years ago I started getting pains in...
View Articleunittest.mock and mock 1.0 alpha 1
One of the results of the Python Language Summit at PyCon 2012 is that mock is now in the Python standard library. In Python 3.3 mock is available as unittest.mock. ... [501 words]
View Article