File: README.rst

package info (click to toggle)
python-nose-exclude 0.5.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 160 kB
  • sloc: python: 331; makefile: 13
file content (100 lines) | stat: -rw-r--r-- 2,903 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Overview
========

nose-exclude is a `Nose`_ plugin that allows you to easily specify
directories to be excluded from testing.

.. _Nose: http://somethingaboutorange.com/mrl/projects/nose


Exclude Directories
===================

The ``--exclude-dir=`` option is made available after installation of the
plugin. The option may be used multiple times to exclude multiple directories 
from testing. The directory paths provided may be absolute or relative.

Example::

    $ nosetests --exclude-dir=test_dirs/build \
        --exclude-dir=test_dirs/test_not_me test_dirs
    ....
    ----------------------------------------------------------------------
    Ran 4 tests in 0.006s

    OK

This example will exclude the directories test_dirs/build and
test_dirs/test_not_me from nosetests' test searching.

Using File-Based Exclusion List
-------------------------------

The ``--exclude-dir-file=`` option can be used to pass in a predefined
list of directories contained within a file. ``nose-exclude`` expects each
directory to be excluded to be on its own line.

Example::

    $ nosetests --exclude-dir-file=test_dirs/exclude_dirs.txt \
        test_dirs
    ....
    ----------------------------------------------------------------------
    Ran 4 tests in 0.006s

    OK

where ``exclude_dirs.txt`` might look like: ::

    test_dirs/build
    # Start a line with a '#' to include
    # Comments
    test_dirs/test_not_me


Excluding Specific Test Methods and Classes
-------------------------------------------

Tests can now be excluded by specifying their fully qualified test paths.
Tests can be excluded using either ``--exclude-test`` or ``--exclude-test-file``.

To exclude test methods:

``--exclude-test=module1.module2.TestClass.test_method``

To exclude test classes:

``--exclude-test=module1.module2.TestClass``

To exclude test functions:

``--exclude-test=module1.module2.test_function``


Using Environment Variables
---------------------------

``--exclude-dir=`` and ``--exclude-test=`` can be set by the environment
variables ``NOSE_EXCLUDE_DIRS`` and ``NOSE_EXCLUDE_TESTS`` respectively.
Multiple exclude paths may be entered by separating them using a ``;``. The
environment variable ``NOSE_EXCLUDE_DIRS_FILE`` when set to the path of a
file-based exclusion list functions as though it were passed in with
``--exclude-dir-file=``.

Nose Configuration Files
========================

``nose-exclude`` options can also be passed to ``nosetests`` using a ``.noserc`` or ``nose.cfg`` file. If you more than one directory are to be excluded 
separate their values with newlines using the same configuration key: ::

    [nosetests]
    exclude-dir=test_dirs/exclude_dirs
                test_dirs/more_excludes



Bugs
====
Please report all bugs (and patches) to https://github.com/kgrandis/nose-exclude/

NOTE: The previous bitbucket repository is no longer actively maintained.