Busy making things: tinycast, github, links, photos, @mc.

Django: Trivial Patch

Posted: July 21st, 2005 | Author: | Filed under: Django, Open Source, Projects, Python | 4 Comments »

Last night I ran across a deprecation warning when running django-admin.py startproject <projectname>, so I went to file a ticket but found that someone else had experienced the same problem. I looked at the solution, and on the surface it looked like the fix involved replacing from whrandom import choice to from random import choice. Indeed that was all it took, so I submitted a (trivial) patch and continued to bang on Django a bit more.

That trivial patch made me really wish that there were unit tests for Django. I would have felt a lot better knowing that after applying my patch n tests still passed with flying colors. Without a test framework in place, I really had no idea if my trivial search and replace broke something. It’s possible that somewhere in the code was really expecting some behavior specific to whrandom that was just slightly different than the behavior of random.

I’m going to hunt around for other little trivial fixes that don’t require carnal knowledge of the codebase and submit patches if I can come up with a fix. At the same time I hope that Nelson’s test suite ticket gets noticed. I wouldn’t mind doing some of the dirty work once a framework is in place, but as always I defer to Adrian and the core Django team when it comes to policy and implementation.


4 Comments on “Django: Trivial Patch”

  1. 1 Simon Willison said at 4:02 am on July 22nd, 2005:

    Unit tests are definitely one of the key things missing from Django. I have an ambition to write a set of unit tests for the database stuff (to ensure that the postgres, mysql and sqlite backends are all operating at the same level of completeness) but it could take me a while to do.

    If you’re interested in helping out getting some unit tests going for Django, I’m sure Adrian and Jacob would be happy to hear from you on IRC.

  2. 2 matt said at 1:52 pm on July 22nd, 2005:

    Matt-

    I also ran into a
    lack of unit tests recently. Seems that many projects believe that testing is something that end users do…

  3. 3 3a7c9c563592 said at 6:11 am on May 9th, 2008:

    3a7c9c563592…

    3a7c9c5635920c29c637…

  4. 4 EZuMdxO said at 2:12 pm on February 1st, 2011:

    sKJmPPa