We use nose to discover tests and run them. All the tests are written in TestCase
compatible way so any test runner can run the. Problem is we have some directories which doesn't have any test. But test runner continue to discover test from there. If one of those directory has lot of files its stuck. So how can I exclude that directory?
Currently I am executing
nosetests --processes=10 --verbosity 2
But there is a directory called scripts
which takes ages to discover tests from it. So I want to exclude it. I tried
nosetests --processes=10 --verbosity 2 --exclude='^scripts$'
But no luck.
There is a
nose-exclude
plugin specifically for the task:Among other features, it introduces a new command-line argument called
exclude-dir
:Instead of passing a command-line argument, you can also set
NOSE_EXCLUDE_DIRS
environment variable, or setexclude-dir
configuration key in.noserc
ornose.cfg
files.Perhaps not what the OP asked for, but I found this tidbit from the nose docs useful to exclude a file from consideration:
You can also use the
--ignore-files
argument to exclude specific files. Since this is using regular expressions, you can name your files inside yourscripts/
folder to begin with a specific prefix that you can then use to match in a regex.See: Nose documentation.