Log in

No account? Create an account

Previous Entry | Next Entry

Originally uploaded by sfllaw.

I’ve been tilting at windmills, recently.

Windmill, actually.

It’s a Python program that lets your computer drive a web browser, without any human interference. We use it at Akoha to run tests that make sure that our website works with Firefox.

We use it to help us test our site with Internet Explorer. So I dutifully set up a Windows machine and tried to get it to run our test suite. I quickly realized that our software was going to need something more Unix-like.

Cygwin is the answer to that problem. It provides a full POSIX environment inside Windows. I built all our software and tried to fire up Windmill.

ImportError: No module named _winreg

Uh oh! Windmill needs to access the Windows Registry. According to the winreg documentation, it’s only available for Windows. Apparently, Cygwin doesn’t count as Windows. So I spent the weekend writing a library that fills in the gap.

cygwinreg allows you to read, write, and explore the Windows Registry from inside Cygwin. Whenever you want to use winreg, use cygwinreg instead.

import sys
if sys.platform == "win32":
        import winreg
    except ImportError:
        import _winreg as winreg
elif sys.platform == "cygwin":
    import cygwinreg as winreg

After I did that, I plugged it in, stepped back and ran my tests. They worked!

Download cygwinreg
or install it with
easy_install cygwinreg


( 9 comments — Leave a comment )
7th Apr, 2009 09:16 (UTC)
Do you mind if i ask what the level of adoption of Python in your work environment is ? What about in your personal projects ?
7th Apr, 2009 12:55 (UTC)
Akoha uses Python and Django as the base for its software. Of course, we’re very language agnostic, so it’s the right tool for the right job, but Python is our main language.

As for personal projects, I don’t really have time for those. :P
(Deleted comment)
7th Apr, 2009 12:54 (UTC)
Sadly no, I can’t make it out to CodeCon this year. :(
7th Apr, 2009 17:18 (UTC)
omg, this is some nerdy shit sisi!
8th Apr, 2009 03:13 (UTC)
You bet it is!
7th Apr, 2009 17:38 (UTC)
I've had far better luck with Selenium and Selenium RC. The RC being nice so that you can drive the various browsers remotely.
8th Apr, 2009 03:16 (UTC)
Windmill is like Selenium RC, but has a much nicer interface. We looked at Selenium RC and although it’s more mature, they made some interesting design decisions that made us drop it.
7th Apr, 2009 22:21 (UTC)
Ho Gung Fu...
8th Apr, 2009 03:38 (UTC)
( 9 comments — Leave a comment )