In my previous post, I mentioned a serious bug that had kept my motivation low since autumn 2011.

The bug is about renaming .py files. Imagine you have a unit test It is testing, and when pytddmon is running, all tests are green. You decide you want to rename to because of reason(tm). Since is doing import some, but doesn’t exist anymore, there will be an exception when trying to run the tests in – which in turn fails that unit test. That should make pytddmon sad and red, right?

Wrong! It does not – pyddmon stays green*!

That is why I call it the rename bug (link to issue page).

I found it extremely odd for a long time, and I had a clear memory of this working at some point of pytddmons history. So I tested for the existence of this bug in every single revision (>100!) of pytddmon going back all the way to the launchpad days. Not in a single version did pytddmon work as expected; the bug was there all the time.

So I gave up for awhile. And then later on I built the Monitor class and refactored, refactored, refactored. Still not red!!! What the hell was going on?

Then it hit me how stupid I am. It was the .pyc files! They are left beside the .py file and CPython/pytddmon loads them instead of the renamed file! Face palm!

Anyway, to make a long story short, this sort of thing clearly is something out-of-scope for pytddmon to care for. For example, the exact same (mis)behavior exists when using basic unittest running: python will import some.pyc and not However, in Python3.2 the rename problem is non-existent: .pyc files behave differently. Read PEP3147 for details (thanks for hint on this Neppord!).

One more reason to start using Python3.2 more! :)

*this is not true if you are using Python3.2. Read the rest of the blog post to understand why!

Leave a Comment

Sharing Buttons by Linksku