nose-testconfig: released.

July 28th, 2008 § 6 comments

lrg_shape_nose.jpgA cou­ple of weeks ago I shot an email to the testing-in-python list ask­ing if any­one knew of a nose plu­gin that could pass test-specific con­fig­u­ra­tion data to the tests themselves.

No one had any­thing — but in true open source spirit, I was vol­un­teered to sat­isfy my own request.

What I wanted was some­thing sim­ple, fast, and flex­i­ble. In fact, I wanted it so flex­i­ble as to be com­pletely inse­cure and dan­ger­ous. I wanted to be able to sup­port Con­fig­Parser, YAML and pure Python con­fig­u­ra­tion files.

One of the future goals is to have the con­fig­u­ra­tion file data gen­er­ated by some man­age­ment layer respon­si­ble for coor­di­nat­ing nose test exe­cu­tion — so some­thing flex­i­ble leaves my options open.

I wanted to avoid hav­ing a con­fig­u­ra­tion mod­ule too out of band of the test exe­cu­tion sys­tem itself, but flex­i­ble enough to sup­port a vari­ety of data sources. It would be sim­ple to auto-generate con­fig­u­ra­tion from a basic YAML file and a data­base for example.

So, I hacked a plu­gin together — I spent most of my time learn­ing a lot about nose inter­nals and muck­ing around with var­i­ous con­fig­u­ra­tion languages.

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

It’s at ver­sion 0.3 because I burned a ver­sion on learn­ing the mag­i­cal prop­er­ties of PyPi upload­ing. Why my ReST is not pars­ing for the doc­u­men­ta­tion, 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 vic­tory! Fear not though! I do plan on adding features/bugfixes as I find them or, bet­ter yet, if peo­ple point them out/request things.

p.s.: No it’s not pep 8 com­pli­ant right now. Also, YAML is awesome.

Edit: I’ve uploaded the code to google-code. I con­sid­ered launch­pad, as I want to try out bzr, but launch­pad actu­ally suf­fers from too many fea­tures for some­thing only 104 lines long.

  • http://rene.f0o.com/ Rene Dud­field

    hi,

    this sounds quite use­ful :) I can def­i­nitely see the need for it.

    In pygame Nicholas added using com­mand line argu­ments to pass con­fig­u­ra­tion data into tests. Using opt­parse. It’s worked out quite well. We’re not using nose though.

    cu,

  • jnoller

    I’ve used var­i­ous tech­niques for pass­ing in con­fig­u­ra­tion data before — in some cases, an opt­parse works — but it doesn’t scale to hun­dred of val­ues. Also, using a plain text key:value also doesn’t scale exceed­ingly well.

    The plu­gin itself could be used in a non-nose project eas­ily. It doesn’t use a lot of inter­nal 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 syn­tax verification :)

  • http://www.goodold.se Hugo Wet­ter­berg

    Hi, just wanted to tell you that your retro nose-shaping pic­ture shows up as “say no to image leech­ing. next time it could be porn.” in Google Reader (through Planet Python). I hope that you’re not fol­low­ing through on that threat :)

  • jnoller

    ooooops — I was try­ing to add .htac­cess rules to pre­vent some image leech­ing. I’ve removed the rules — sorry about that.

  • http://www.goodold.se Hugo Wet­ter­berg

    Hi, just wanted to tell you that your retro nose-shaping pic­ture shows up as “say no to image leech­ing. next time it could be porn.” in Google Reader (through Planet Python). I hope that you’re not fol­low­ing through on that threat :)

  • http://jessenoller.com jnoller

    ooooops — I was try­ing to add .htac­cess rules to pre­vent some image leech­ing. I’ve removed the rules — sorry about that.

What's this?

You are currently reading nose-testconfig: released. at jessenoller.com.

meta