update script for unittest2 integration

Django is moving to use unittest2 as part of the default test suite. Unfortunately, it needs to be bundled, which means that it will live in django.utils.unittest rather than in the pythonpath where it expects to be. This means that we need to patch the import statements. I’ve written a little script to download the latest version, untar it into the appropriate directory, and make the changes.


#!/bin/sh
rm -v django/utils/unittest/*.py*
wget http://hg.python.org/unittest2/archive/tip.tar.gz -O unittest2.tar.gz
tar --wildcards --no-wildcards-match-slash --strip-components=2 --directory=django/utils/unittest -xf unittest2.tar.gz unittest2-*/unittest2/*.py
rm -v unittest2.tar.gz
sed -i 's/^from unittest2/from django\.utils\.unittest/' django/utils/unittest/*.py
echo "unittest2 updated"

Run it from the root of the svn checkout.

Post a Comment

Your email is never published nor shared. Required fields are marked *