home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / checkbox / plugins / suites_info.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-10-12  |  2.3 KB  |  43 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from checkbox.lib.template_i18n import TemplateI18n
  5. from checkbox.properties import List, Path, String
  6. from checkbox.plugin import Plugin
  7. from checkbox.test import Test
  8.  
  9. class SuitesInfo(Plugin):
  10.     directories = List(type = Path(), default_factory = (lambda : '%(checkbox_share)s/suites'))
  11.     scripts_path = Path(default = '%(checkbox_share)s/scripts')
  12.     data_path = Path(default = '%(checkbox_share)s/data')
  13.     blacklist = List(type = String(), default_factory = (lambda : ''))
  14.     whitelist = List(type = String(), default_factory = (lambda : ''))
  15.     
  16.     def register(self, manager):
  17.         super(SuitesInfo, self).register(manager)
  18.         self._manager.reactor.call_on('gather', self.gather)
  19.  
  20.     
  21.     def gather(self):
  22.         template = TemplateI18n('suite', [
  23.             'name'])
  24.         elements = template.load_directories(self.directories, self.blacklist, self.whitelist)
  25.         for element in elements:
  26.             long_ext = '_extended'
  27.             for long_key in element.keys():
  28.                 if long_key.endswith(long_ext):
  29.                     short_key = long_key.replace(long_ext, '')
  30.                     element[short_key] = element.pop(long_key)
  31.                     continue
  32.             
  33.             test = Test(self._manager.registry, **element)
  34.             for command in (test.command, test.description):
  35.                 command.add_path(self.scripts_path)
  36.                 command.add_variable('data_path', self.data_path)
  37.             
  38.             self._manager.reactor.fire('test-%s' % test.plugin, test)
  39.         
  40.  
  41.  
  42. factory = SuitesInfo
  43.