Archiv für April 2008

Python code coverage

Today I was playing with python-coverage, which seems to be the tool of choice for code coverage measurement in Python. Since I am constantly hacking on Jockey’s test suite, I want to strive for perfection and cover everything, so it does sound like something worthwhile.

First I tried to use it like documented:

python /usr/share/python-support/python-coverage/coverage.py -x tests/run

which just caused the tests not to run at all, for no immediately obvious reason (it worked fine with real Python modules in apport). However, it gets much nicer once you stop trying to wrap it around the command line call and start to integrate it into the test suite code itself:

import coverage
coverage.erase()
coverage.exclude('raise NotImplementedError')
coverage.start()

[... run all the tests ... ]

coverage.stop()
coverage.report(glob(‘jockey/*.py’))
coverage.report(glob(‘examples/handlers/*.py’))
coverage.erase()

(which is more or less what I committed).

This will run all the tests, and give me a report about how much code they covered, plus a list of code lines which weren’t touched. For example:

Name                 Stmts   Exec  Cover   Missing
jockey/handlers        248    242    97%   402-405, 420-421, 514

Also, the exclude() interface is much more flexible than putting #pragmas all over the place (which do not seem to really work anyway unfortunately).

Now, off to fixing everything to get 100%. I was surprised how many little bugs I found and fixed while completing the tests. Test suites FTW!!

Tags: , ,

Howdy!

After 17 hours of long flights and hectic interchanges I made it to Austin, Texas last Saturday, yay!

Admittedly there are much fewer cowboy hats around here than I anticipated (but then again, Austin is said to be the most non-Texanian city in Texas). Instead I have to readjust my mental scale of the size of everything; the country itself, the vast cars, the hilariously big TV in my giant hotel room.

I could sleep surprisingly well, I was awake between 4 and 6 am, but fell asleep again for two hours fortunately. I spent the Sunday morning with fixing some bugs and some jockey improvements.

Around noon I met again with Jon Masters, and we drove to San Antonio to visit the The Alamo Mission. It is a great historic place which presents the wild history of Texas and the U.S. at large. It’s hard to believe how drastically both changed within the last 150 to 100 years, and to see the complex “relationships” (read: “neverending wars”) between the Mexican and USian settlers, the Federalists and Centralists, etc. Irony of history: less than 150 years ago, the Mexican states complained about the rush of immigrating U.S. settlers which would subvert and destroy their culture…

Later on we spent an hour strolling along the San Antonio River Walk. From the description I expected some wild nature along the river, but it turned out to be a a cozy and lively center of cultural and touristical live, crammed with small bars and restaurants, and dozens of boats with hundreds of tourists. Well, it was a warm and sunny Sunday afternoon after all :-). However, after ten minutes of walking it became much quieter and relaxing, a totally different perspective than you get when being on the ground floor, when you are in a typical American city.

Then we went back to Austin and picked up Soren Hansen, who joined us for the evening. We went to have a little walk through Austin itself, mainly to see the rather impressive Texas State Capitol (although the boss was not there; what a slacker :-P), and the 6th street, where all the cool bars and restaurants are. We had a beer, later on a classic burger, and finished the night with two rounds of pool and a rather long walk.

The new toy in town

After having (happily) lived without a TV for about 8 years, I now bought a DVB-T USB stick (cheap Hauppauge Nova WinTV). Not so much because I would actually watch TV a lot, but I’d like to improve Ubuntu in the future to support them out of the box.

That turned out to be much harder than I anticipated: Even if Hardy is not even released yet, the kernel is already too old to have the necessary modules, so I built the modules from the upstream development tree, which fortunately worked flawlessly. linux-restricted-modules even has the firmware already.

Then I had to google and fiddle for a while to get a channels.conf. This is a point where Ubuntu/GNOME could really do with some integration and improvements. Finding a “scan” input file for Dresden was still relatively easy, but I don’t want to imagine what people have to do who live in small towns or villages.

But, after that, totem played TV very well, yippie! My current application of choice is Me-TV, a small, slick, and great application which can watch TV, offers a comfortable electronic program guide, and can record manually/automatically as well. Together with oggconvert I now have everything I need.

Getting ready for Austin

I’m really looking forward to go to Austin next Saturday, for my first LinuxFoundation collaboration summit. I’m particularly interested in bringing forward the work of the Driver Backport workgroup, where my focus is on delivering drivers to the user.

Tags: ,