First, get a copy of the project:

cd ~/my_projects  # or whatever

git clone

cd django-model-permissions


You don’t need invoke or a virtualenv if you just want to run tox. It runs each environment in its own virtualenv. For anything else its highly recommended to create a virtualenv!


The easiest way to manage your development environment is to use invoke. Install it into your global site-packages by running pip install invoke as root. Then use inv -l in the git repository root to list available tasks.


Install virtualenv:

sudo pip install virtualenv
inv develop
virtualenv venv

. venv/bin/activate

python develop


Install virtualenvwrappper:

inv develop -w
mkvirtualenv --python=/usr/bin/python3 django-model-permissions


python develop


inv test

The tox test matrix is updated regularly and runs the test-suite against sqlite, postgresql and current django versions on all installed python interpreters (except python2). See tox.ini or run tox -l in the repository for the current test matrix.

pip install tox

tox --skip-missing-interpreters


You’ll want to create a virtualenv first! The tests have some dependencies which will clutter your global site-packages, otherwise.

cd tests/

python test -v 2

Running specific tests

  • Use the -e argument to run only one of the environments in the test matrix:

    tox -e py35-django21-sqlite
  • Use the --tag argument to run only tests decorated with a specific django.test.tag():

    First, decorate a class or a test function:

    from django.test import tag
    class SomeTestCase(unittest.TestCase):
        def test_xyz(self):
    inv test -a "--tag debug"
    tox -- --tag debug
    cd tests/
    python test --tag debug
  • Combine the two above to run one test in one tox environment:

    tox -e py35-django21-sqlite -- --tag debug


inv lint
pip install -r tests/lint_requirements.txt

flake8 --statistics --count

Render the documentation

inv docs
cd docs/

pip install -r requirements.txt

sphinx-build -b html . _build/html


To create new migrations for the app run:

inv makemigrations

The test project is used to create migrations:

cd tests/

python migrate

python makemigrations model_permissions

python migrate