Skip to content

creotiv/django-nosetests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

This is package for testing with Nose under Django framework.

Package contain code from http://bitbucket.org/kmike/django-coverage/src that
goes under Apache License 2.0

Installation:
    easy_install coverage
    python htmlplug/setup.py install
    pyhton django-nosetests/setup.py install

Main options:
    TEST_RUNNER, COVERAGE_REPORT_HTML_OUTPUT_DIR, COVERAGE_ADDITIONAL_MODULES,
    NOSE_SCHEMA

    Example:
    TEST_RUNNER = 'django_nosetests.nr.run_tests'

    COVERAGE_REPORT_HTML_OUTPUT_DIR = os.path.join(SITE_ROOT, 'test_report')
    COVERAGE_ADDITIONAL_MODULES = ['libs','apps']

    NOSE_SCHEMA =  os.path.join(SITE_ROOT, 'schema.sql')

Full list of config options:
    # Specify arguments that will be passed to the Nose test runner.
    NOSE_ARGV = getattr(settings,'NOSE_ARGS',[])
     
    # Specify the DB Schema with fixstures (if you do not use Django ORM).
    # This is simple SQL FILE or DB dump
    NOSE_SCHEMA = getattr(settings,'NOSE_SCHEMA',None)
     
    # Specify the coverage test runner
    COVERAGE_TEST_RUNNER = getattr(settings, 'COVERAGE_TEST_RUNNER',
                                   'django_nosetests.nr.run_tests')
     
    # Specify regular expressions of code blocks the coverage analyzer should
    # ignore as statements (e.g. ``raise NotImplemented``).
    # These statements are not figured in as part of the coverage statistics.
    # This setting is optional.
     
    COVERAGE_CODE_EXCLUDES = getattr(settings, 'COVERAGE_CODE_EXCLUDES',[
                                        'def __unicode__\(self\):',
                                        'def get_absolute_url\(self\):',
                                        'from .* import .*', 'import .*',
                                        '^__.*__.*','^[a-zA-Z0-9\_\-]*\s*=\s*.*'
                                     ])
     
    # Specify a list of regular expressions of paths to exclude from
    # coverage analysis.
    # Note these paths are ignored by the module introspection tool and take
    # precedence over any package/module settings such as:
    # TODO: THE SETTING FOR MODULES
    # Use this to exclude subdirectories like ``r'.svn'``, for example.
    # This setting is optional.
    COVERAGE_PATH_EXCLUDES = getattr(settings, 'COVERAGE_PATH_EXCLUDES',
                                     [r'.svn'])
     
    # Specify a list of additional module paths to include
    # in the coverage analysis. By default, only modules within installed
    # apps are reported. If you have utility modules outside of the app
    # structure, you can include them here.
    # Note this list is *NOT* regular expression, so you have to be explicit,
    # such as 'myproject.utils', and not 'utils$'.
    # This setting is optional.
    COVERAGE_ADDITIONAL_MODULES = getattr(settings, 'COVERAGE_ADDITIONAL_MODULES', [])
     
    # Specify a list of regular expressions of module paths to exclude
    # from the coverage analysis. Examples are ``'tests$'`` and ``'urls$'``.
    # This setting is optional.
    COVERAGE_MODULE_EXCLUDES = getattr(settings, 'COVERAGE_MODULE_EXCLUDES',
                                       ['tests$', 'settings$', 'urls$', 'locale$',
                                        'common.views.test', '__init__', 'django',
                                        'migrations'])
     
    # Specify the directory where you would like the coverage report to create
    # the HTML files.
    # You'll need to make sure this directory exists and is writable by the
    # user account running the test.
    # You should probably set this one explicitly in your own settings file.
     
    #COVERAGE_REPORT_HTML_OUTPUT_DIR = '/my_home/test_html'
    COVERAGE_REPORT_HTML_OUTPUT_DIR = getattr(settings,
                                              'COVERAGE_REPORT_HTML_OUTPUT_DIR',
                                              None)

Running tests:
    python manage.py test
     

About

Nose test runner for Django with cool html reports

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages