root/galaxy-central/eggs/nose-0.11.1-py2.6.egg/nose/plugins/allmodules.py @ 3

リビジョン 3, 1.7 KB (コミッタ: kohda, 14 年 前)

Install Unix tools  http://hannonlab.cshl.edu/galaxy_unix_tools/galaxy.html

行番号 
1"""Use the AllModules plugin by passing ``--all-modules`` or setting the
2NOSE_ALL_MODULES environment variable to enable collection and execution of
3tests in all python modules. Normal nose behavior is to look for tests only in
4modules that match testMatch.
5
6More information: :doc:`../doc_tests/test_allmodules/test_allmodules`
7
8.. warning ::
9
10   This plugin can have surprising interactions with plugins that load tests
11   from what nose normally considers non-test modules, such as
12   the :doc:`doctest plugin <doctests>`. This is because any given
13   object in a module can't be loaded both by a plugin and the normal nose
14   :class:`test loader <nose.loader.TestLoader>`. Also, if you have functions
15   or classes in non-test modules that look like tests but aren't, you will
16   likely see errors as nose attempts to run them as tests.
17
18"""
19
20import os
21from nose.plugins.base import Plugin
22
23class AllModules(Plugin):
24    """Collect tests from all python modules.
25    """
26    def options(self, parser, env):
27        """Register commandline options.
28        """
29        env_opt = 'NOSE_ALL_MODULES'
30        parser.add_option('--all-modules',
31                          action="store_true",
32                          dest=self.enableOpt,
33                          default=env.get(env_opt),
34                          help="Enable plugin %s: %s [%s]" %
35                          (self.__class__.__name__, self.help(), env_opt))
36
37    def wantFile(self, file):
38        """Override to return True for all files ending with .py"""
39        # always want .py files
40        if file.endswith('.py'):
41            return True
42
43    def wantModule(self, module):
44        """Override return True for all modules"""
45        return True
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。