Posts in “Python”

Knowing what you want can make a huge difference (…with pymongo)

So I’ve got a piece of MongoKit code that simply wraps a pymongo query and it looks like this times = defaultdict(list) for pq in (db.PlayedQuestion.collection .find({'play.$id': {'$in': play_ids}})): if pq['time'] is not None: if pq['right']: times['right'].append(pq['time']) elif pq['answer']: times['wrong'].append(pq['time']) What I noticed was … Continue reading

A Humane Python Test Runner

I have a bit of a dot dependency. As someone who spends a lot of time running tests on his Python code, my mind now self-administers a minute dopamine hit with every dot emitted by my test runner. But nose’s standard test runner has some shortcomings. I’ve written a plugin called nose-progressive that addresses them to make debugging speedier. Continue reading