nose-testconfig: released.

lrg_shape_nose.jpgA couple of weeks ago I shot an email to the testing-in-python list asking if anyone knew of a nose plugin that could pass test-specific configuration data to the tests themselves.

No one had anything – but in true open source spirit, I was volunteered to satisfy my own request.

What I wanted was something simple, fast, and flexible. In fact, I wanted it so flexible as to be completely insecure and dangerous. I wanted to be able to support ConfigParser, YAML and pure Python configuration files.

One of the future goals is to have the configuration file data generated by some management layer responsible for coordinating nose test execution – so something flexible leaves my options open.

I wanted to avoid having a configuration module too out of band of the test execution system itself, but flexible enough to support a variety of data sources. It would be simple to auto-generate configuration from a basic YAML file and a database for example.

So, I hacked a plugin together – I spent most of my time learning a lot about nose internals and mucking around with various configuration languages.

Today, I finally got to upload the fruit of my loom (ha.) to PyPi – behold: nose-testconfig

It’s at version 0.3 because I burned a version on learning the magical properties of PyPi uploading. Why my ReST is not parsing for the documentation, I don’t know.

Right now, it works – it parses what it should parse, extends nose and I can use it in my tests. This smells like victory! Fear not though! I do plan on adding features/bugfixes as I find them or, better yet, if people point them out/request things.

p.s.: No it’s not pep 8 compliant right now. Also, YAML is awesome.

Edit: I’ve uploaded the code to google-code. I considered launchpad, as I want to try out bzr, but launchpad actually suffers from too many features for something only 104 lines long.

  • Hi, just wanted to tell you that your retro nose-shaping picture shows up as "say no to image leeching. next time it could be porn." in Google Reader (through Planet Python). I hope that you're not following through on that threat :)
  • ooooops - I was trying to add .htaccess rules to prevent some image leeching. I've removed the rules - sorry about that.
  • hi,

    this sounds quite useful :) I can definitely see the need for it.

    In pygame Nicholas added using command line arguments to pass configuration data into tests. Using optparse. It's worked out quite well. We're not using nose though.


    cu,
  • I've used various techniques for passing in configuration data before - in some cases, an optparse works - but it doesn't scale to hundred of values. Also, using a plain text key:value also doesn't scale exceedingly well.

    The plugin itself could be used in a non-nose project easily. It doesn't use a lot of internal nose-isms, in fact it's only 104 lines of code. It's easy to keep it short when you don't do a ton of syntax verification :)
blog comments powered by Disqus