Development
Get a copy of the project:
git clone https://git.m-stelzer.de/knoppo/django-model-permissions.git
cd django-model-permissions
Create a virtualenv and install the project:
python -m venv venv
. venv/bin/activate
python setup.py develop
Tests
The tox test matrix is updated regularly and runs the test-suite against sqlite,
postgresql and current django versions. See tox.ini or run tox -l
in the
repository for the current test matrix.
pip install tox
tox
cd tests/
python manage.py test -v 2
Running specific tests
Use the
-e
argument to run only one of the environments in the test matrix:tox -e django21-sqlite
Use the
--tag
argument to run only tests decorated with a specificdjango.test.tag()
:First, decorate a class or a test function:
from django.test import tag class SomeTestCase(unittest.TestCase): @tag('debug') def test_xyz(self): pass @tag('debug') class SomeTestCase(unittest.TestCase):
tox -- --tag debug
cd tests/ python manage.py test --tag debug
Combine the two above to run one test in one tox environment:
tox -e django21-sqlite -- --tag debug
lint
tox -e flake8
pip install -r tests/lint_requirements.txt
flake8 --statistics --count
Render the documentation
tox -e docs
cd docs/
pip install -r requirements.txt
sphinx-build -b html . _build/html
makemigrations
To create new migrations for the app run:
tox -e makemigrations
The test project is used to create migrations:
cd tests/
python manage.py migrate
python manage.py makemigrations model_permissions
python manage.py migrate