當前位置: 首頁>>代碼示例>>Python>>正文


Python Plugin.configure方法代碼示例

本文整理匯總了Python中nose.plugins.base.Plugin.configure方法的典型用法代碼示例。如果您正苦於以下問題:Python Plugin.configure方法的具體用法?Python Plugin.configure怎麽用?Python Plugin.configure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在nose.plugins.base.Plugin的用法示例。


在下文中一共展示了Plugin.configure方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: configure

# 需要導入模塊: from nose.plugins.base import Plugin [as 別名]
# 或者: from nose.plugins.base.Plugin import configure [as 別名]
def configure(self, options, config):
        """Configure plugin.
        """
        Plugin.configure(self, options, config)
        self.doctest_result_var = options.doctest_result_var
        self.doctest_tests = options.doctest_tests
        self.extension = tolist(options.doctestExtension)
        self.fixtures = options.doctestFixtures
        self.finder = doctest.DocTestFinder()
        self.optionflags = 0
        if options.doctestOptions:
            flags = ",".join(options.doctestOptions).split(',')
            for flag in flags:
                try:
                    if flag.startswith('+'):
                        self.optionflags |= getattr(doctest, flag[1:])
                    elif flag.startswith('-'):
                        self.optionflags &= ~getattr(doctest, flag[1:])
                    else:
                        raise ValueError(
                            "Must specify doctest options with starting " +
                            "'+' or '-'.  Got %s" % (flag,))
                except AttributeError:
                    raise ValueError("Unknown doctest option %s" %
                                     (flag[1:],)) 
開發者ID:singhj,項目名稱:locality-sensitive-hashing,代碼行數:27,代碼來源:doctests.py

示例2: configure

# 需要導入模塊: from nose.plugins.base import Plugin [as 別名]
# 或者: from nose.plugins.base.Plugin import configure [as 別名]
def configure(self, options, conf):
        """Configure plugin.
        """
        if not self.available():
            self.enabled = False
            return
        Plugin.configure(self, options, conf)
        self.conf = conf
        if options.profile_stats_file:
            self.pfile = options.profile_stats_file
            self.clean_stats_file = False
        else:
            self.pfile = None
            self.clean_stats_file = True
        self.fileno = None
        self.sort = options.profile_sort
        self.restrict = tolist(options.profile_restrict) 
開發者ID:singhj,項目名稱:locality-sensitive-hashing,代碼行數:19,代碼來源:prof.py

示例3: configure

# 需要導入模塊: from nose.plugins.base import Plugin [as 別名]
# 或者: from nose.plugins.base.Plugin import configure [as 別名]
def configure(self, options, config):
        # it is overriden in order to fix doctest options discovery

        Plugin.configure(self, options, config)
        self.doctest_result_var = options.doctest_result_var
        self.doctest_tests = options.doctest_tests
        self.extension = tolist(options.doctestExtension)
        self.fixtures = options.doctestFixtures
        self.finder = doctest.DocTestFinder()

        #super(DoctestPluginHelper, self).configure(options, config)
        self.optionflags = 0
        self.options = {}

        if options.doctestOptions:
            stroptions = ",".join(options.doctestOptions).split(',')
            for stroption in stroptions:
                try:
                    if stroption.startswith('+'):
                        self.optionflags |= doctest.OPTIONFLAGS_BY_NAME[stroption[1:]]
                        continue
                    elif stroption.startswith('-'):
                        self.optionflags &= ~doctest.OPTIONFLAGS_BY_NAME[stroption[1:]]
                        continue
                    try:
                        key,value=stroption.split('=')
                    except ValueError:
                        pass
                    else:
                        if not key in self.OPTION_BY_NAME:
                            raise ValueError()
                        self.options[key]=value
                        continue
                except (AttributeError, ValueError, KeyError):
                    raise ValueError("Unknown doctest option {}".format(stroption))
                else:
                    raise ValueError("Doctest option is not a flag or a key/value pair: {} ".format(stroption)) 
開發者ID:rafasashi,項目名稱:razzy-spinner,代碼行數:39,代碼來源:doctest_nose_plugin.py

示例4: configure

# 需要導入模塊: from nose.plugins.base import Plugin [as 別名]
# 或者: from nose.plugins.base.Plugin import configure [as 別名]
def configure(self, options, config):
        # parent method sets enabled flag from command line --with-numpydoctest
        Plugin.configure(self, options, config)
        self.finder = self.test_finder_class()
        self.parser = doctest.DocTestParser()
        if self.enabled:
            # Pull standard doctest out of plugin list; there's no reason to run
            # both.  In practice the Unplugger plugin above would cover us when
            # run from a standard numpy.test() call; this is just in case
            # someone wants to run our plugin outside the numpy.test() machinery
            config.plugins.plugins = [p for p in config.plugins.plugins
                                      if p.name != 'doctest'] 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:14,代碼來源:noseclasses.py

示例5: configure

# 需要導入模塊: from nose.plugins.base import Plugin [as 別名]
# 或者: from nose.plugins.base.Plugin import configure [as 別名]
def configure(self, options, config):
        Plugin.configure(self, options, config)
        self.enabled = True 
開發者ID:ntfreedom,項目名稱:neverendshadowsocks,代碼行數:5,代碼來源:nose_plugin.py

示例6: configure

# 需要導入模塊: from nose.plugins.base import Plugin [as 別名]
# 或者: from nose.plugins.base.Plugin import configure [as 別名]
def configure(self, options, config):
        """Configures the xunit plugin."""
        Plugin.configure(self, options, config)
        self.config = config
        if self.enabled:
            self.stats = {'errors': 0,
                          'failures': 0,
                          'passes': 0,
                          'skipped': 0
                          }
            self.errorlist = []
            self.error_report_file_name = os.path.realpath(options.xunit_file) 
開發者ID:singhj,項目名稱:locality-sensitive-hashing,代碼行數:14,代碼來源:xunit.py

示例7: configure

# 需要導入模塊: from nose.plugins.base import Plugin [as 別名]
# 或者: from nose.plugins.base.Plugin import configure [as 別名]
def configure(self, options, config):
        """Configures the xunit plugin."""
        Plugin.configure(self, options, config)
        self.config = config
        if self.enabled:
            self.stats = {'errors': 0,
                          'failures': 0,
                          'passes': 0,
                          'skipped': 0
                          }
            self.errorlist = []
            self.error_report_file = codecs.open(options.xunit_file, 'w',
                                                 self.encoding, 'replace') 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:15,代碼來源:xunit.py


注:本文中的nose.plugins.base.Plugin.configure方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。