Archives Sept. 1, 2011

Run coverage of your Django test suite...

Since there is a 4-year old still-open ticket on this, thought I'd provide a simple recipe for getting a coverage report on your Django project:

pip install coverage
coverage run path/to/ test myapp
coverage report -m --include="*myapp*"
coverage erase # clean up afterward/between runs

Sure, it's not --with-coverage, but it does seem to work.

Choices for Foo?

The choices_for_FOO hook would allow a model to restrict the choices for a given field based on e.g. another field (common requirement where you have row-level authorization and need to restrict choices to the set of records accessible by the auth-row attached to this object).  It's currently a patch attached to a 5 year old ...

Continue reading

Previous day

Aug. 22, 2011

Next day

Sept. 5, 2011