Note to self: It is actually possible to select a single test module or a single test function in py.test. But passing the file name as argument to a py.test invocation selects only the doctest from that file (wtf!?). Instead, you need to call it like this: $ py.test -k test_module # to run the [...]
I was planning to attend DebConf New York this year, but for a number of reasons I decided not to go. Fortunately, Ferdinand Thommes organized a MiniDebConf in Berlin at LinuxTag and I managed to attend. Thanks, Ferdinand! There were a number of interesting Talks. I especially liked the talk of our DPL, and those [...]
I was working on replacing some mockup code for testing an internal library with python. Basically, the C code is incredibly big and I would rather mock the 3rd party API we are using in python. I wrote a generator to create wrapping code that forwards the C API calls to my python module. Now [...]
The python optparse package is really handy for parsing command line arguments. When combining this with an extra main function idiom (to allow interactive usage or use as a module), I ran into a small problem – the following code does not run: def main(foo, bar): print(“foo: %s, bar: %s\n” % (foo, bar)) if __name__ [...]
Not sure if anybody will ever need this. I just found out because I did not accept that I can’t load my Subversion pre-commit hook as a module. Of course it is actually quite simple: import imp hook = imp.load_source(“hook”, “pre-commit”) It’s that easy. Now I can test the internal functions from ipython before letting [...]