Skip to main content

Improved unittest test runner

Project description

Run Python unittests automatically. Re-run tests when source has changed. Try to make intelligent decisions about which tests to run.

Example

In project directory with unittests:

$ autocheck discover -v

Accepts the same options as python -m unittest.

Installation

$ pip install autocheck

Optionally, for Growl support:

$ pip install gntp

Install watchdog kernel support according to https://pythonhosted.org/watchdog/installation.html.

Django support

Tell django to use our test runner, in settings:

TEST_RUNNER = 'autocheck.contrib.django.TestSuiteRunner'

Or on the command line:

./manage.py test --testrunner=autocheck.contrib.django.TestSuiteRunner

Run tests automatically whenever source has changed:

$ autocheck

autocheck tries to figure out if it runs in a django project (./manage.py exists, contains DJANGO_SETTINGS_MODULE, django is importable). Additionally, if a file test_settings.py exists, DJANGO_SETTINGS_MODULE=test_settings is added to the environment.

Behind the scenes, there are two test runners for django, selected during import of autocheck.contrib.django.TestSuiteRunner:

  • autocheck.contrib.django.discoveryrunner.TestSuiteRunner for recent versions of django (>=1.6)

  • autocheck.contrib.django.testsuiterunner.TestSuiteRunner for older versions (<1.6)

The latter is not compatible with the old ./manage.py test command, instead it tries to reproduce the interface of python -m unittest.

The other one is a thin wrapper around django’s DiscoverRunner, adding a few command line switches for our custom TestRunner.

Statistics

Dump the test database with:

$ autocheck --stats

Or:

$ autocheck --stats-flat

Tests

Build Status

Install test requirements:

$ pip install .
$ pip install -r requirements/test.txt

For Python-2.6 additionaly:

$ pip install -r requirements/python-2.6.txt

Run in project directory:

$ PYTHONPATH=. ./bin/autocheck discover -v --once

Tested against Python-2.6, 2.7, 3.3, 3.4, PyPy 2 and 3.

TODO

  • make autocheck.autorunner file pattern configurable

  • config file(s)

  • documentation for tags and tag expressions

  • documentation for autocheck command line flags

  • --help for autocheck command

License

This is free and unencumbered software released into the public domain.

see UNLICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autocheck-0.2.6.tar.gz (89.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autocheck-0.2.6-py2.py3-none-any.whl (89.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file autocheck-0.2.6.tar.gz.

File metadata

  • Download URL: autocheck-0.2.6.tar.gz
  • Upload date:
  • Size: 89.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for autocheck-0.2.6.tar.gz
Algorithm Hash digest
SHA256 47e1efc97f64f0ef96a964f12244617543867535f5c77b61381d2523c8417635
MD5 d91e3a561455bc880d21af9fbc7301c5
BLAKE2b-256 9057e8a3ea014af5fe340031af5b73b19f7d69e19695e6212271efbb22bbaa31

See more details on using hashes here.

File details

Details for the file autocheck-0.2.6-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for autocheck-0.2.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 53c049ee23e0c4b31993cc4a92633b140a0ff97f7a055c9cd47c843704fb82ec
MD5 c37136a2d97148abd8a156e8e0190646
BLAKE2b-256 0a0215ea47760f575b4354b644e9ed9bbc2cff8605391a4e746c86c47fbda729

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page