.. _development: ########### Development ########### Get a copy of the project: .. code-block:: bash git clone https://git.m-stelzer.de/knoppo/django-model-permissions.git cd django-model-permissions Create a *virtualenv* and install the project: .. code-block:: bash python -m venv venv . venv/bin/activate python setup.py develop Tests ===== .. tabs:: .. group-tab:: tox 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. .. code-block:: bash pip install tox tox .. group-tab:: manual .. code-block:: bash 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: .. code-block:: bash tox -e django21-sqlite * Use the ``--tag`` argument to run only tests decorated with a specific :func:`django.test.tag`: First, decorate a class or a test function: .. code-block:: python from django.test import tag class SomeTestCase(unittest.TestCase): @tag('debug') def test_xyz(self): pass @tag('debug') class SomeTestCase(unittest.TestCase): .. tabs:: .. group-tab:: tox .. code-block:: bash tox -- --tag debug .. group-tab:: manual .. code-block:: bash cd tests/ python manage.py test --tag debug * Combine the two above to run one test in one *tox* environment: .. code-block:: bash tox -e django21-sqlite -- --tag debug lint ==== .. tabs:: .. group-tab:: tox .. code-block:: bash tox -e flake8 .. group-tab:: manual .. code-block:: bash pip install -r tests/lint_requirements.txt flake8 --statistics --count Render the documentation ======================== .. tabs:: .. group-tab:: tox .. code-block:: bash tox -e docs .. group-tab:: manual .. code-block:: bash cd docs/ pip install -r requirements.txt sphinx-build -b html . _build/html makemigrations ============== To create new migrations for the app run: .. tabs:: .. group-tab:: tox .. code-block:: bash tox -e makemigrations .. group-tab:: manual The test project is used to create migrations: .. code-block:: bash cd tests/ python manage.py migrate python manage.py makemigrations model_permissions python manage.py migrate .. _django: https://www.djangoproject.com/ .. _postgresql: https://www.postgresql.org/ .. _python2: https://docs.python.org/2/ .. _sqlite: https://www.sqlite.org/ .. _tox: https://tox.readthedocs.io/en/latest/