[TIP] Django custom test runner with Jenkins
Jonathan Hartley
tartley at tartley.com
Sat Mar 17 04:21:10 PDT 2012
Hey all,
I got a lot of out Carl Meyer's PyCon talk "Testing and Django":
http://pyvideo.org/video/699/testing-and-django
One of his suggestions is a custom Django test runner to augment test
discovery, by subclassing DjangoTestSuiteRunner, and referencing it in
settings.TEST_RUNNER.
I went down this route a while back, but then ripped it out and reverted
to Django's built-in test runner when we added Jenkins CI to our project
a handful of weeks later, because Jenkins has its own test runner, that
by itself doesn't find all the tests that my/Carl's test runner would
discover. I lacked the wherewithall to get Jenkins to use my custom test
runner, while still performing all the actions that Jenkins itself needs.
Am I missing a trick? Is this actually easy?
The alternative solution I switched to was to have every Django app's
"tests.py" call a function which does test discovery, and then inject
the discovered TestCase classes into the tests.py module namespace, so
that Django's default testrunner will find tests no matter where I put them.
I'd prefer Carl's solution, but I'm tripping up getting it to play nice
with Jenkins. Suggestions appreciated.
Jonathan
(I presume Carl's on the list: If so, thanks very much for the talk -
I'm the guy who sat next to you at the PyCon sprints at one point and
threatened to watch the video of your talk while sitting next to you.)
--
Jonathan Hartley tartley at tartley.com http://tartley.com
Made of meat. +44 7737 062 225 twitter/skype: tartley
More information about the testing-in-python
mailing list