예제 #1
0
 def setUp(self):
     self.backup = []
     # paranoid check
     self.cfgstr = str(cfg)
     # clean up externals cfg for proper testing
     if cfg.has_section("externals"):
         self.backup = copy.deepcopy(cfg.items("externals"))
     cfg.remove_section("externals")
예제 #2
0
 def setUp(self):
     self.backup = []
     # paranoid check
     self.cfgstr = str(cfg)
     # clean up externals cfg for proper testing
     if cfg.has_section('externals'):
         self.backup = copy.deepcopy(cfg.items('externals'))
     cfg.remove_section('externals')
예제 #3
0
 def tearDown(self):
     if len(self.backup):
         # wipe existing one completely
         if cfg.has_section("externals"):
             cfg.remove_section("externals")
         cfg.add_section("externals")
         for o, v in self.backup:
             cfg.set("externals", o, v)
     # paranoid check
     # since order can't be guaranteed, lets check
     # each item after sorting
     self.failUnlessEqual(sorted(self.cfgstr.split("\n")), sorted(str(cfg).split("\n")))
예제 #4
0
 def tearDown(self):
     if len(self.backup):
         # wipe existing one completely
         if cfg.has_section('externals'):
             cfg.remove_section('externals')
         cfg.add_section('externals')
         for o,v in self.backup:
             cfg.set('externals', o,v)
     # paranoid check
     # since order can't be guaranteed, lets check
     # each item after sorting
     self.failUnlessEqual(sorted(self.cfgstr.split('\n')),
                          sorted(str(cfg).split('\n')))
예제 #5
0
파일: externals.py 프로젝트: B-Rich/PyMVPA
                  (dep, {True:'', False:' NOT'}[result], estr))

    if not result:
        if raise_ \
               and cfg.getboolean('externals', 'raise exception', True):
            raise RuntimeError, "Required external '%s' was not found" % dep
        if issueWarning is not None \
               and cfg.getboolean('externals', 'issue warning', True):
            if issueWarning is True:
                warning("Required external '%s' was not found" % dep)
            else:
                warning(issueWarning)


    # store result in config manager
    if not cfg.has_section('externals'):
        cfg.add_section('externals')
    if result:
        cfg.set('externals', 'have ' + dep, 'yes')
    else:
        cfg.set('externals', 'have ' + dep, 'no')

    return result

# Bind functions for some versions checkings
versions._KNOWN.update({
    'numpy' : __assign_numpy_version,
    'scipy' : __assign_scipy_version,
    'nipy' : __assign_nipy_version,
    'matplotlib': __assign_matplotlib_version,
    'mdp' : __assign_mdp_version,
예제 #6
0
                    False: ' NOT'
                }[result], estr))

    if not result:
        if raise_ \
               and cfg.getboolean('externals', 'raise exception', True):
            raise RuntimeError, "Required external '%s' was not found" % dep
        if issueWarning is not None \
               and cfg.getboolean('externals', 'issue warning', True):
            if issueWarning is True:
                warning("Required external '%s' was not found" % dep)
            else:
                warning(issueWarning)

    # store result in config manager
    if not cfg.has_section('externals'):
        cfg.add_section('externals')
    if result:
        cfg.set('externals', 'have ' + dep, 'yes')
    else:
        cfg.set('externals', 'have ' + dep, 'no')

    return result


# Bind functions for some versions checkings
versions._KNOWN.update({
    'numpy': __assign_numpy_version,
    'scipy': __assign_scipy_version,
    'nipy': __assign_nipy_version,
    'mdp': __assign_mdp_version,