/drft

Django REST Framework Toolkit

Primary LanguagePythonMIT LicenseMIT

DRFT

Django REST Framework Toolkit (DRFT)

Code style: black codecov Build

Installation

pip install drft

Local Development

Pyenv

It's recommended that you use pyenv, which you can read about more here.

pyenv-installer

curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

Install Poetry

This project uses poetry, which you can read more about here. Install it using the following command.

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -

More instructions here

Installing dependencies

poetry install

Install pre-commit hooks:

poetry run pre-commit install --hook-type commit-msg
poetry run pre-commit install

Running Tests

For running tests this project uses both pytest and tox.

tox

Adding Tests

All tests are housed in the tests package. Two markers are made available to explicitly distinguish between unit and integration tests.

# in test_some_util.py
import pytest


@pytest.mark.unit
class TestSomeUtil:
    def test_basic_signature(self):
        ...


@pytest.mark.integration
class TestSomeUtilInApp:
    def test_app_workflow(self):
        ...

More information on pytest's markers can be found here.

To run just the unit tests:

pytest -m unit

To run everything but the unit tests:

pytest -m "not unit"