Skip to main content

djtest

An interactive test runner for Django projects.

Purposes:

  • keep the list of apps available for test in a local configuration file

  • display the list of all available unit tests (-l option)

  • run unit tests for apps specified on command line

  • cleanup a test “media folder” before each execution

  • optionally filter the list of unit tests to be executed (-f option)

Installation

pip install djtest

or:

pip install git+https://github.com/morlandi/djtest

Sample usage

Using config file "./.djtest.conf"
usage: djtest [-h] [-v {0,1,2,3}] [-m] [-n] [-f FILTER] [-l] [apps [apps ...]]

Targets may specify either: 'all' for all available apps, and app name (one or
more), or a specific test module/method

positional arguments:
  apps

optional arguments:
  -h, --help            show this help message and exit
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level. (default: 2)
  -m, --no-migrations   Skip migrations. (default: False)
  -n, --dry-run         Don't execute commands, just pretend. (default: False)
  -f FILTER, --filter FILTER
                        Filtering: run only test methods matching specified pattern
                        (multiple patterns separated by ',')
  -l, --list            List available test methods
  --version             show program's version number and exit

Available apps: tasks, wallet_clients, frontend_api, trading_api, backend

Sample config file

A sample “skeleton” config file “./.djtest.conf” is automatically created on first run.

You should edit it to specify the list of testable apps.

[general]
project=myproject
test_settings_module=myproject.settings.test_settings
test_settings_no_migrations_module=myproject.settings.test_settings_no_migrations
media_folder="../public/test_media/"
apps=app1, app2, appN

Sample “test settings” module

from myproject.settings.settings import *

LANGUAGE_CODE = 'en'
TIME_ZONE = 'UTC'
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

...

Sample “test settings - no migrations” module

from myproject.settings.test_settings import *

class DisableMigrations(object):

    def __contains__(self, item):
        return True

    def __getitem__(self, item):
        #return "notmigrations"
        return None


MIGRATION_MODULES = DisableMigrations()

History

v0.1.9

  • ignore media_folder when empty

v0.1.8

  • force the stdout and stderr streams to be unbuffered

v0.1.7

  • fix –list option when no filter have been specified

v0.1.6

  • Accept multiple filters separated by ‘,’

  • Improved checks for command line parameters

v0.1.5

  • Create sample test settings files

  • rename dry_run and deprecations options

  • removed dependency on “six”

v0.1.4

  • config file: use either ‘,’ or spaces as separators in the app list

v0.1.3

  • –deprecations switch added

v0.1.2

  • cleanup

v0.1.1

  • add test settings example to Readme

v0.1.0

  • published on PyPI

v0.0.3

  • added versioning

  • added support for unittest.TestCase

Metadata

Release files for djtest 0.1.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for djtest 0.1.9
File Interpreter ABI Platform
djtest-0.1.9-py2.py3-none-any.whl Python 3, Python 2 none any Details

Release files / djtest-0.1.9-py2.py3-none-any.whl

Download URL djtest-0.1.9-py2.py3-none-any.whl
Size 7.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
9a3a1cfac6d0697cd25e2f639b213e3475a3cd758cfbd09e949d27fc4c40823d
BLAKE2b-256 checksum
How to use checksums
f35c59bab0528e9f4b1319cbfe75882974beda0b4212df0567aa5e9d5296a796
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.3 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

Release history Release notifications | RSS feed

This release

0.1.9 This release

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page