Some weeks ago, I got a message on bitbucket telling me KrunoSaho requested me to pull some changes into pyTDDmon.
I got really curious and cloned his fork ”Always on top”, and, just as the name implies, it forces the pyTDDmon window to stay on top of other windows. This is the essential line of code:
But – what a difference a row made!
This neat feature was only semi-available previously via the ”Always on top”-checkbox found in every Ubuntu-window*. I used to tick that box every time I booted pyTDDmon on Ubuntu. Annoying.
And such a checkbox is not even available on Windows, which made pyTDDmon really uncomfortable to use in that OS. I’m not sure how Mac OSX worked in this regard – but anyway, now pyTDDmon behaves like this out-of-the-box, as it should do.
So I want to say ”Thank you” to KrunoSaho, and mention that this fork was one of the reasons I realized pyTDDmon needed it’s own home on the internet.
BTW – stories like this is one of the reasons I love open source software!
* I guess it’s really a GNOME feature, but anyway.
I put together the first prototype of pytddmon autumn 2009.
It was a real quick-hack. I threw together nosetests and pygame, and the result was a tiny square window which only featured a color, nothing else.
The use of pygame for the GUI is like bringing a kitchen because you want a coffe-machine, since pygame includes image-loading & display, sound & music loading & playback, collission detection and more (it’s meant for 2d games development).
"I want coffee! So I'll bring my kitchen" :)
Anyway, the reason for this blogpost is to give credit to one of the first contributors to pytddmon: Fredrik Wendt. He helped me switch from pygame to Tkinter in the breaks inbetween seminars of the FSCONS2009.
Thanks for coercing me to do the inevitable and drop the kitchen, Fredrik!
I hacked away tonight, trying to make pyTDDmon support both Python 2 and 3 – at the same time. The last point is important, because I want pyTDDmon to stay a single-file distribution. I would say it worked better than I had expected.
Some of the changes I had to make includes:
1. ”import Tkinter” becomes ”import tkinter” in Python 3
2. def set_result(self, (green, total)) is not valid in Python 3. No support for ”tuple splitting”! Simple change: def set_result(self, green, total).
(don’t ask me why I used the tuple in the arguments of set_result. I have no good answer!)
3. All icon related code was commented out. It was not used anyway, and caused a hazard of encoding-problems (differences between Python 2 and 3 strings..)
I tested it with the following operating systems and Python versions:
– Windows + Python 2.7
– Windows + Python 3.2
– Ubuntu10.10 + Python 2.6
– Ubuntu10.10 + Python 2.7
– Ubuntu10.10 + Python 3.1
You can try this experimental version of pyTDDmon by downloading the development version of pyTDDmon.py. I am not daring enough to publish it as the stable version yet 😉
Tonight, I wanted to try out pyTDDmon with the latest interface changes.
So I thought I’d go for a cool little kata I’ve been thinking of for some time now: implementing a Reverse Polish Notation calculator.
I coded using Programmers Notepad 2 (a quite new editor acquaintance to me, I like it! Minimalistic yet powerful enough), while having pyTDDmon running in the background.
I also kept everything in a single file for simplicity’s sake. Check it out: test_rpn.py.
After consulting with Carlos Ble (on the mailing list), I’ve decided to strip some clutter from the main window of pyTDDmon.
The image shows pyTDDmon’s main window before (to the left) and after (to the right) in Windows.
As you can see, the window lacks maximize/minimize buttons, and the Tkinter-icon (which I found quite, hrm, kitsch) is gone too.
Also, instead of writing lots of different text messages depending on the number of tests that passes/fails, I simply type the number of passing tests (left number) divided by the total number of tests (right number).
Some more small improvements:
- The window is clickable, thus should feel like a button, more or less. So I added a raised border around it, making it look more clickable!
- The Details window, displayed when clicking pyTDDmon, appeared below pyTDDmon. A bug now removed.
- There was a graphical artifact near the right border of the main window, seen in the image above. Fixed.
Update: bitbucket.org (where pyTDDmon’s source is hosted) has some file-caching mechanism, so the download-file didn’t update. I didn’t like that, so I’ve moved the primary download location to this server instead.
This is the brand new home of pytddmon. It will contain announcements, rumours and facts about pytddmon, the continous test-driven development tool for Python.
pytddmon is an open-source application written in Python, that helps out testing Python-based software.