Skip to content

Instantly share code, notes, and snippets.

@mtigas
Created February 14, 2012 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtigas/1823336 to your computer and use it in GitHub Desktop.
Save mtigas/1823336 to your computer and use it in GitHub Desktop.
how to get your own fork of django and run the testcases so you can be a good citizen and help make django better or something

tl;dr how to hack on django and run the test suite

fork your own copy of django first, then change the git@github.com:mtigas/django.git bit to your repo's private URL.

cd ~/Code
virtualenv --no-site-packages django
cd django
echo "export PIP_RESPECT_VIRTUALENV=true" >> bin/activate
echo "export PYTHONPATH=\"\$VIRTUAL_ENV/test_src:\$VIRTUAL_ENV/repo\"" >> bin/activate
echo "export DJANGO_SETTINGS_MODULE=\"settings\"" >> bin/activate
source bin/activate

git clone git@github.com:mtigas/django.git repo
cd repo
git remote add upstream git://github.com/django/django.git
git fetch --all
cd $VIRTUAL_ENV

mkdir test_src
touch test_src/__init__.py
curl -sLo test_src/settings.py https://gist.github.com/raw/1823336/settings.py

keeping up to date:

# enter virtualenv
cd ~/Code/django
source bin/activate

# update your repos, maybe
cd repo
git fetch --all
# do this if you want to update your fork with the upstream official repo
#git pull upstream master

running tests:

# enter the virtualenv as above

# run you a test suite
python repo/tests/runtests.py -v 2

# enjoy waiting forever and watching the verbose fireworks

running some tests: look at the tests/modeltests and tests/regressiontests inside the repo.

# enter the virtualenv as above

# run the `reserved_names` modeltest suite and the
# `staticfiles_tests` regressiontest suite
python repo/tests/runtests.py -v 2 reserved_names staticfiles_tests

protip: you can turn off the "super verbose" flag (-v 2) if you'd like

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
},
}
# to run tests, this needs to be set but apparently this file doesn't even
# need to exist
ROOT_URLCONF = 'foo.urls'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment