Generating test functions dynamically in Python
Some tests I write get tedious and repetitive, even with custom asserts to make it easier. For instance, take this test from a Django project I’m working on:
Posting strings using HTTPie
Some time ago I came across this great command line tool to make http requests: HTTPie. Simple and intuitive API:
Testing infinite loops
Yesterday I was working on a script that should run forever, or at least until the user stops it. The library behind it was already tested except for this little function:
Last week I wrote a post about unnecessary classes, and that kept me thinking about how common people write classes or more complex designs upfront just because it would be easier to evolve and extend later.
Today I opened a python module that made me feel sad. It has two classes: one of them has 4 methods, all of them static, and no attributes; the other has only one method:
__init__, and 5 attributes.
Python coverage threshold
Ned Batchelder committed a new feature to coverage.py 2 days ago, it’s a way to verify coverage threshold. Basically a way to fail your tests if the coverage is not enough. For now you need to install from the repository to get the new feature
Improving performance of Django test suite
I’m working on a small django application these days which offers templates to override django-filebrowser’s templates to remove the Grappelli dependency.
Vagrant plugin to take screenshots
I’ve been using Vagrant a lot at work. These days we were facing some problems when our VMs were booting and a friend, jbochi, came up with an idea to take a screenshot from a running VM.