Package: django-setuptest
Django SetuptestSimple module enabling Django app testing via $ python setup.py test.ContentsDjango SetuptestInstallationUsageSample OutputAuthorsPraekelt FoundationContributorsChangelog0.2.1 (2016-01-04)0.2 (2015-10-30)0.1.6 (2015-01-13)0.1.5 (2014-09-11)0.1.4 (2013-06-21)0.1.3 (2013-05-23)0.1.2 (2012-07-02)0.1.1 (2012-06-19)0.0.9 (2012-06-15)0.0.8 (2012-06-13)0.0.7 (2012-06-04)0.0.6 (2011-09-08)0.0.5 (2011-09-06)0.0.4 (2011-09-06)0.0.3 (2011-08-30)0.0.2 (2011-08-29)0.0.1 (2011-08-29)Normally when you execute$ python setup.py testfor Django related
modules you’re almost certain to run intoDJANGO_SETTINGS_MODULEenvironment variable issues, e.g.:ImportError: Settings cannot be imported, because environment variable
DJANGO_SETTINGS_MODULE is undefined.This module overcomes this by configuring theDJANGO_SETTINGS_MODULEenvironment variable before executing your test suite. As a bonus it also
generatesCoverageandPEP 8reports as part of the test.InstallationProvide atest_suiteargument to the setup call specifying thesetuptest.setuptest.SetupTestSuitetest suite, e.g.:setup(
    # ...
    test_suite='setuptest.setuptest.SetupTestSuite',
)Alternatively provide acmdclasstestargument to the setup call
specifying thesetuptest.testcommand, e.g.:from setuptest import test

#...

setup(
    # ...
    cmdclass={'test': test},
)This overrides Python’s builtintestcommand to enable the Django
testrunner as well as allowing you to pass--failfastas a commandline
argument, i.e.:$ python setup.py test --failfastFor thecmdclassmethod to workdjango-setuptoolsshould be
installed and available in your Python path prior to running thetestcommand, in which casedjango-setuptestis not required to be specified
as part of thetests_requiredargument as detailed next.Provide atests_requireargument to the setup call includingdjango-setuptest(required only if not already installed) and other
package dependencies needed to execute the tests, e.g.:setup(
    # ...
    tests_require=(
        'django-setuptest',
    ),
)Specify your test specific Django settings in atest_settingsmodule in the same path as your app’ssetup.py.
These settings will be used when executing the tests, e.g. intest_settings.py:DATABASE_ENGINE = 'sqlite3'

INSTALLED_APPS = (
    'myapp',
)In order for the test suite to find your tests you must provide either apackagesorpy_modulesargument to the setup call, e.g.:from setuptools import setup, find_packages

setup(
    # ...
    packages=find_packages(),
)

# Or alternatively...

setup(
    # ...
    py_modules=['myapp'],
)UsageOnce correctly configured you can execute tests from the command line:$ python setup.py testor, if you want the test suite to stop after the first test failure is
detected:$ python setup.py test --failfastThis should output your test results as well asCoverageandPEP 8reports.NoteAn XML Coverage report is generated in a file calledcoverage.xmland a PEP8 report is generated in a file calledpep8.txtTo mute the output of theCoverageandPEP 8reports provide the--quietoption:$ python setup.py test --quietTo automatically restart the test runner when code changes are detected (similar to howrunserverrestarts) provide the--autoreloadoption:$ python setup.py test --autoreloadTo only run tests for a particular test case specify the test case as the--labeloption:$ python setup.py test --label app.TestCaseOr for a particular test method specify the test case’s test method as the--labeloption:$ python setup.py test --label app.TestCase.test_methodSample OutputExample output of dummy test includingCoverageandPEP 8reports:$ python setup.py test
running test
running egg_info
writing django_dummy.egg-info/PKG-INFO
writing top-level names to django_dummy.egg-info/top_level.txt
writing dependency_links to django_dummy.egg-info/dependency_links.txt
reading manifest file 'django_dummy.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'django_dummy.egg-info/SOURCES.txt'
running build_ext
Creating test database for alias 'default'...
E
======================================================================
ERROR: test_something (dummy.tests.TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/user/tmp/django-dummy/dummy/tests/__init__.py", line 6, in test_something
    raise NotImplementedError('Test not implemented. Bad developer!')
NotImplementedError: Test not implemented. Bad developer!

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)
Destroying test database for alias 'default'...

Coverage Report:
Name              Stmts   Miss  Cover   Missing
-----------------------------------------------
dummy/models      20      2    90%   22, 55

PEP8 Report:
dummy/tests/__init__.py:6:1: W391 blank line at end of file

$AuthorsPraekelt FoundationShaun SephtonHedley RoosContributorsJannis LeidelChangelog0.2.1 (2016-01-04)Support Django 1.9.0.2 (2015-10-30)Django 1.8 support (lamby).Exclude south_migrations from PEP8 checks (mikebryant).0.1.6 (2015-01-13)Added saving of raw coverage data0.1.5 (2014-09-11)Introduced support for Django 1.7.0.1.4 (2013-06-21)South patches the test management command to handle the SOUTH_TESTS_MIGRATE setting. Apply that patch if South is installed.0.1.3 (2013-05-23)Python 3 compatibility.0.1.2 (2012-07-02)Exclude South migrations from Pep8.0.1.1 (2012-06-19)Corrections to support PEP8 backwards incompatible API update.0.0.9 (2012-06-15)Now supports running specific test classes or methods via the label option.0.0.8 (2012-06-13)Added autoreload option restarting testrunner on code change detection.0.0.7 (2012-06-04)Refactor into a test command allowing for failfast commandline argument.0.0.6 (2011-09-08)Refactor, cleanup, self contained suite class.0.0.5 (2011-09-06)Added frame hack to resolve packages and py_modules to test, no longer needs app specific test suite.0.0.4 (2011-09-06)Refactored the app to use a callback style approach instead of monkey patching. Thanksjezdez.0.0.3 (2011-08-30)More robust test settings import.0.0.2 (2011-08-29)Repeat Pep 8 errors.0.0.1 (2011-08-29)Initial release.