The Python Nose test framework has a several advantages over Django's default test framework. I personally wanted to use Nose because of the xunit plugin which can output results in xunit format. I needed this output format so that test results could be interpreted by Bamboo, the continuous integration solution we're using at my work.
For using Nose with Django, the django-nose package is an obvious choice. However, it requires setting several settings values in your settings.py file that were only used by Nose. Also, I like being able to run my tests using Django's default test runner. I'm familiar with the output format, with the syntax for specifying how to run a single test, etc. and I didn't want to limit myself to running only Nose tests.
The approach I took was to create a new settings file for running nose tests. This would contain just the settings needed for configuring django-nose, and import the main settings file to fill in the rest. This is kind of the opposite of the usual pattern of importing a "local_settings.py" file at the bottom of your main "settings.py" to specify scenario specific settings (e.g. development vs production).
The comments in the script specify how to use it. I hope it's helpful.
No comments:
Post a Comment