the further adventures of

Mike Pirnat

a leaf on the wind


On Friday I ran across this modest proposal to make the output of Python's unittest2 more closely resemble the emotional state of the tester when there are a lot of failing unit tests. Once my coworkers were done asking if I was all right, or if they should be worried about the cackling and giggles coming from my cube, I resolved to make this dream a reality.

My workplace has settled on the nose testing framework. Like other frameworks, nose offers a plugin architecture to allow all kinds of additional customization and tweaks, and since I had never written one before, it seemed like this might be a good opportunity to give it a try. I found the plugin development docs to be a little too terse and not terribly n00b-friendly, but over the course of a couple of hours I was able to cobble something together. (I mostly ended up cheating off of Kumar McMillan's nose-nicedots, which got me over the hurdle of realizing I needed my own flavor of TestResult to make sure I got the usual stack trace output while still emitting the F's and U's correctly.)

It basically goes like this:

$ nosetests --with-f7u12

FAIL: test_f7u12.TestGeneratesLotsOfFailures.test_generates_failures(7,)
Traceback (most recent call last):
line 197, in runTest
line 15, in _make_a_test
    assert False

< lots more test failure output; use your imagination... >

Ran 50 tests in 0.021s

FAILED (errors=30)

After some wrangling with PyPI (which could also be a lot friendlier to a packaging n00b--big thanks to Michael Foord for helping set me straight), it should be easy_install-able, or you can grab the source from Github (patches welcome!). And if you prefer pytest over nose, it looks like they've got a plugin too.

It's a tremendously silly thing, but it brought me some joy; I hope it can brighten your day too, or at least bring some comfort and commiseration to your test failure rage.

Read and Post Comments

Return to Clepy; Possible End of the Universe

Forget the LHC--a far surer sign that the end times are nigh is that I've finally been able to attend Clepy for the first time in about 15 months. (In case I do actually cause the implosion of the universe, let me take this opportunity to apologize in advance. Sorry about that; my bad!)

We had an extra-long social period at the start of this month's meeting (while there were some misadventures with pizza delivery), but the bonus casual time was great for meeting new people and getting caught up with people I hadn't seen in a long time.

The main focus of the meeting tonight was a live demo of Gary Bernhardt's TDD tools, Dingus and Mote. I'd seen a little bit of Dingus from following Gary on Twitter, but had not ever seen it in action, and Mote was brand new to me. Dingus is a mocking library that attempts to aggressively and magically isolate the code under test from everything external to it. Mote is a lightweight spec-runner (not "test-runner!") that wants to remove as much verbosity as possible. Thanks to some nifty decorator-fu that makes it super-easy to rig up automatic Dingus isolation in your Mote specs, the two combine to form some kind of TDD Voltron. Mote's a little rough around the edges, but it's brand new and under heavy development, and shows a ton of potential. If you're interested in testing or TDD, check out these tools!

The unsung star of tonight's presentation was Gary's .vimrc, which contains powerful magics for quickly running tests from within vim and displaying their success or failure as a green or red line at the bottom of the buffer. There's plenty more fascinating arcana in there, so it's nice to know that his dot files are on bitbucket too. I'll eventually peruse and dissect them.

This was Clepy's first meeting at LeanDog's floating headquarters; I was really pleased with it as a venue. It's centrally located, easy to get to and from, is highly geek-friendly, and is quite novel as a meeting space. (It's on a boat! Next to a submarine! How great is that?!) I hope we can continue to meet here as it really seems like a positive change. It was also great to see new faces and meet new people tonight; it seems like the group has really started to thrive independently of AGI.

Above all, I really hope to be able to start attending regularly again, even if it does trigger the apocalypse.

Read and Post Comments