Example #1
0
 def __init__(self):
     Plugin.__init__(self)
     self.post_data_dir = None
     self.max_postdata_threshold = None
     self.__save_data_count = 0
     self.__priv_sn = ''
     self.du = DshUtils()
Example #2
0
 def __init__(self):
     self.__identifier = None
     self.__testClient = None
     self.__logFolderPath = None
     self.__parsedConfig = None
     '''
     Contains Config File
     '''
     self.__configFile = None
     '''
     Signifies the Zone against which all tests will be Run
     '''
     self.__zoneForTests = None
     '''
     Signifies the flag whether to deploy the New DC or Not
     '''
     self.__deployDcFlag = None
     self.conf = None
     self.__resultStream = stdout
     self.__testRunner = None
     self.__testResult = SUCCESS
     self.__startTime = None
     self.__testName = None
     self.__tcRunLogger = None
     self.__testModName = ''
     self.__hypervisorType = None
     '''
     The Log Path provided by user where all logs are routed to
     '''
     self.__userLogPath = None
     Plugin.__init__(self)
Example #3
0
 def __init__(self):
     Plugin.__init__(self)
     self.driver = None
     self.config = {}
     self.environment = None
     self.driver_initializer_fn = lambda _: None
     self.logger = holmium.core.log
Example #4
0
 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:
             if not flag or flag[0] not in '+-':
                 raise ValueError(
                     "Must specify doctest options with starting " +
                     "'+' or '-'.  Got %s" % (flag, ))
             mode, option_name = flag[0], flag[1:]
             option_flag = doctest.OPTIONFLAGS_BY_NAME.get(option_name)
             if not option_flag:
                 raise ValueError("Unknown doctest option %s" %
                                  (option_name, ))
             if mode == '+':
                 self.optionflags |= option_flag
             elif mode == '-':
                 self.optionflags &= ~option_flag
Example #5
0
    def configure(self, options, config):
        Plugin.configure(self, options, config)
        if not self.enabled:
            return

        self.verbosity = options.verbosity
        if options.quickunit_prefix:
            self.prefixes = options.quickunit_prefix
            if len(self.prefixes) == 1:
                self.prefixes = self.prefixes[0].split('\n')
        else:
            self.prefixes = ["tests/"]
        self.parent = 'master'

        self.logger = logging.getLogger(__name__)

        # pending files becomes a set of directorie pieces that represent
        # the file locations changed in this diff
        # for example, if /foo/bar/baz.py was changed, pending files would contain
        # set([('foo', 'bar', 'baz')])
        self.pending_files = set()

        # diff is a mapping of filename->set(linenos)
        self.diff_data = defaultdict(set)

        # store a list of filenames that should be accepted
        self.file_cache = FileAcceptedCache(self.prefixes, self.pending_files, self.diff_data)
 def configure(self, options, config):
     """
     Configure plugin.
     """
     try:
         self.status.pop('active')
     except KeyError:
         pass
     Plugin.configure(self, options, config)
     if self.enabled:
         try:
             import coverage
         except ImportError:
             log.error("Coverage not available: "
                       "unable to import coverage module")
             self.enabled = False
             return
     self.conf = config
     self.coverErase = options.cover_erase
     self.coverTests = options.cover_tests
     self.coverPackages = []
     if options.cover_packages:
         for pkgs in [tolist(x) for x in options.cover_packages]:
             self.coverPackages.extend(pkgs)
     self.coverInclusive = options.cover_inclusive
     if self.coverPackages:
         log.info("Coverage report will include only packages: %s",
                  self.coverPackages)
     self.coverHtmlDir = None
     if options.cover_html:
         self.coverHtmlDir = options.cover_html_dir
         log.debug('Will put HTML coverage report in %s', self.coverHtmlDir)
     if self.enabled:
         self.status['active'] = True
Example #7
0
 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:
             if not flag or flag[0] not in '+-':
                 raise ValueError(
                     "Must specify doctest options with starting " +
                     "'+' or '-'.  Got %s" % (flag,))
             mode, option_name = flag[0], flag[1:]
             option_flag = doctest.OPTIONFLAGS_BY_NAME.get(option_name)
             if not option_flag:
                 raise ValueError("Unknown doctest option %s" %
                                  (option_name,))
             if mode == '+':
                 self.optionflags |= option_flag
             elif mode == '-':
                 self.optionflags &= ~option_flag
Example #8
0
 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:],))
Example #9
0
    def configure(self, options, config):
        Plugin.configure(self, options, config)
        if not self.enabled:
            return

        config = read_config(options.kleenex_config, options.kleenex_config_section)

        self.config = config

        assert not (self.config.discover and self.config.record), "You cannot use both `record` and `discover` options."

        self.logger = logging.getLogger(__name__)

        self.pending_funcs = set()
        # diff is a mapping of filename->set(linenos)
        self.diff_data = defaultdict(set)
        # cov is a mapping of filename->set(linenos)
        self.cov_data = defaultdict(set)
        # test test_name->dict(filename->set(linenos))
        self.test_data = defaultdict(dict)

        report_output = config.report_output
        if not report_output or report_output == '-':
            self.report_file = None
        elif report_output.startswith('sys://'):
            pipe = report_output[6:]
            assert pipe in ('stdout', 'stderr')
            self.report_file = getattr(sys, pipe)
        else:
            self.report_file = open(report_output, 'w')
Example #10
0
 def __init__(self):
     Plugin.__init__(self)
     self.driver = None
     self.config = {}
     self.environment = None
     self.driver_initializer_fn = lambda _: None
     self.logger = holmium.core.log
Example #11
0
    def options(self, parser, env):
        """Add options to control coverage."""

        log.debug('nose-cov options')

        Plugin.options(self, parser, env)
        parser.add_option('--cov',
                          action='append',
                          default=env.get('NOSE_COV', []),
                          metavar='PATH',
                          dest='cov_source',
                          help=('Measure coverage for filesystem path '
                                '[NOSE_COV]'))
        parser.add_option(
            '--cov-report',
            action='append',
            default=env.get('NOSE_COV_REPORT', []),
            metavar='TYPE',
            choices=['term', 'term-missing', 'annotate', 'html', 'xml'],
            dest='cov_report',
            help=
            ('Generate selected reports, available types: term, term-missing, annotate, html, xml '
             '[NOSE_COV_REPORT]'))
        parser.add_option(
            '--cov-config',
            action='store',
            default=env.get('NOSE_COV_CONFIG', '.coveragerc'),
            metavar='FILE',
            dest='cov_config',
            help=('Config file for coverage, default: .coveragerc '
                  '[NOSE_COV_CONFIG]'))
Example #12
0
    def configure(self, options, noseconfig):
        """ Call the super and then validate and call the relevant parser for
        the configuration file passed in """
        from ..interfaces.xmlrpc import BugzillaInterface
        from ..interfaces.config import ConfigInterface
        import f5test.commands.icontrol as ICMD
        import f5test.commands.testopia as TCMD

        Plugin.configure(self, options, noseconfig)
        self.options = options

        if options.with_testopia or options.syncplan:
            self.enabled = True
        else:
            return

        self.config_ifc = ConfigInterface()
        testopia = self.config_ifc.api.testopia
        self.testopia_ifc = BugzillaInterface(testopia.address,
                                              testopia.username, testopia.password)
        self.ICMD = ICMD
        self.TCMD = TCMD
        self.product = 'Enterprise Manager'
        self.tcs = {}
        self.tcs_ran = set()
Example #13
0
    def configure(self, options, noseconfig):
        """ Call the super and then validate and call the relevant parser for
        the configuration file passed in """
        from ..interfaces.xmlrpc import BugzillaInterface
        from ..interfaces.config import ConfigInterface
        import f5test.commands.icontrol as ICMD
        import f5test.commands.testopia as TCMD

        Plugin.configure(self, options, noseconfig)
        self.options = options

        if options.with_testopia or options.syncplan:
            self.enabled = True
        else:
            return

        self.config_ifc = ConfigInterface()
        testopia = self.config_ifc.api.testopia
        self.testopia_ifc = BugzillaInterface(testopia.address,
                                              testopia.username,
                                              testopia.password)
        self.ICMD = ICMD
        self.TCMD = TCMD
        self.product = 'Enterprise Manager'
        self.tcs = {}
        self.tcs_ran = set()
Example #14
0
 def __init__(self):
     Plugin.__init__(self)
     self.post_data_dir = None
     self.max_postdata_threshold = None
     self.__save_data_count = 0
     self.__priv_sn = ''
     self.du = DshUtils()
Example #15
0
    def options(self, parser, env):
        """Sets additional command line options."""
        Plugin.options(self, parser, env)
        parser.add_option(
            '--xunit-file',
            action='store',
            dest='xunit_file',
            metavar="FILE",
            default=env.get('NOSE_XUNIT_FILE', 'nosetests.xml'),
            help=("Path to xml file to store the xunit report in. "
                  "Default is nosetests.xml in the working directory "
                  "[NOSE_XUNIT_FILE]"))

        parser.add_option(
            '--xunit-testsuite-name',
            action='store',
            dest='xunit_testsuite_name',
            metavar="PACKAGE",
            default=env.get('NOSE_XUNIT_TESTSUITE_NAME', 'nosetests'),
            help=(
                "Name of the testsuite in the xunit xml, generated by plugin. "
                "Default test suite name is nosetests."))

        parser.add_option('--xunit-show-docstrings',
                          dest='show_docstrings',
                          action='store_true',
                          default=False,
                          help='Adds docstrings to the xunit output.')
Example #16
0
    def options(self, parser, env):
        """Sets additional command line options."""
        Plugin.options(self, parser, env)
        parser.add_option(
            '--xunit-file',
            action='store',
            dest='xunit_file',
            metavar="FILE",
            default=env.get('NOSE_XUNIT_FILE', 'nosetests.xml'),
            help=("Path to xml file to store the xunit report in. "
                  "Default is nosetests.xml in the working directory "
                  "[NOSE_XUNIT_FILE]"))

        parser.add_option(
            '--xunit-testsuite-name',
            action='store',
            dest='xunit_testsuite_name',
            metavar="PACKAGE",
            default=env.get('NOSE_XUNIT_TESTSUITE_NAME', 'nosetests'),
            help=(
                "Name of the testsuite in the xunit xml, generated by plugin. "
                "Default test suite name is nosetests."))

        parser.add_option(
            '--xunit-prefix-with-testsuite-name',
            action='store_true',
            dest='xunit_prefix_class',
            default=bool(
                env.get('NOSE_XUNIT_PREFIX_WITH_TESTSUITE_NAME', False)),
            help=
            ("Whether to prefix the class name under test with testsuite name. "
             "Defaults to false."))
Example #17
0
 def configure(self, options, config):
     """Configures the html-xxx plugin."""
     super(HtmlOutput, self).configure(options, config)
     Plugin.configure(self, options, config)
     self.config = config
     if options.html_file:
         self.html_file = options.html_file
     if options.html_title:
         self.html_title = options.html_title
     if self.enabled:
         self.start_time = datetime.datetime.now()
         self.jinja = jinja2.Environment(loader=jinja2.FileSystemLoader(
             os.path.dirname(options.html_template)),
                                         trim_blocks=True,
                                         lstrip_blocks=True)
         self.jinja_template = options.html_template
         if not hasattr(self.config, '_nose_html_output_state'):
             manager = multiprocessing.Manager()
             self.errorlist = manager.list()
             self.stats = manager.dict(**{
                 'errors': 0,
                 'failures': 0,
                 'passes': 0,
                 'skipped': 0
             })
             self.config._nose_html_output_state = self.errorlist, self.stats
         else:
             self.errorlist, self.stats = self.config._nose_html_output_state
         self.error_report_file_name = os.path.realpath(options.html_file)
         self.html_file_name = options.html_file
Example #18
0
 def options(self, parser, env):
     """Register commandline options.
     """
     if not self.available():
         return
     Plugin.options(self, parser, env)
     parser.add_option('--profile-sort',
                       action='store',
                       dest='profile_sort',
                       default=env.get('NOSE_PROFILE_SORT', 'cumulative'),
                       metavar="SORT",
                       help="Set sort order for profiler output")
     parser.add_option('--profile-stats-file',
                       action='store',
                       dest='profile_stats_file',
                       metavar="FILE",
                       default=env.get('NOSE_PROFILE_STATS_FILE'),
                       help='Profiler stats file; default is a new '
                       'temp file on each run')
     parser.add_option('--profile-restrict',
                       action='append',
                       dest='profile_restrict',
                       metavar="RESTRICT",
                       default=env.get('NOSE_PROFILE_RESTRICT'),
                       help="Restrict profiler output. See help for "
                       "pstats.Stats for details")
Example #19
0
 def options(self, parser, env):
     """Sets additional command line options."""
     Plugin.options(self, parser, env)
     parser.add_option("--html-out-file",
                       action="store",
                       default=env.get('NOSE_HTML_OUT_FILE',
                                       'results.html'),
                       dest="html_file",
                       metavar="FILE",
                       help="Produce results in the specified HTML file."
                       "[NOSE_HTML_OUT_FILE]")
     parser.add_option("--html-out-title",
                       action="store",
                       default=env.get('NOSE_HTML_OUT_TITLE',
                                       'Unittest Report'),
                       dest="html_title",
                       help="The Title of the report in HTML"
                       "[NOSE_HTML_OUT_TITLE]")
     parser.add_option("--html-jinja-template",
                       action="store",
                       default=env.get(
                           'NOSE_HTML_JINJA_TEMPLATE',
                           os.path.join(os.path.dirname(__file__),
                                        "templates", "report.jinja2")),
                       dest="html_template",
                       metavar="FILE",
                       help="jinja2 template file"
                       "[NOSE_HTML_JINJA_TEMPLATE]")
Example #20
0
    def options(self, parser, env):
        """
        Add options to command line.
        """

        Plugin.options(self, parser, env)
        parser.add_option("--cover3-package", action="append",
                          default=env.get('NOSE_COVER_PACKAGE'),
                          metavar="PACKAGE",
                          dest="cover_packages",
                          help="Restrict coverage output to selected packages "
                          "[NOSE_COVER_PACKAGE]")
        parser.add_option("--cover3-erase", action="store_true",
                          default=env.get('NOSE_COVER_ERASE'),
                          dest="cover_erase",
                          help="Erase previously collected coverage "
                          "statistics before run")
        parser.add_option("--cover3-tests", action="store_true",
                          dest="cover_tests",
                          default=env.get('NOSE_COVER_TESTS'),
                          help="Include test modules in coverage report "
                          "[NOSE_COVER_TESTS]")
        parser.add_option("--cover3-branch", action="store_true",
                          dest="cover_branch",
                          default=env.get('NOSE_COVER_BRANCH'),
                          help="Include branch coverage. "
                          "[NOSE_COVER_BRANCH]")
        parser.add_option("--cover3-exclude", action="store",
                          dest="cover_exclude",
                          default=env.get('NOSE_COVER_EXCLUDE'),
                          type="string",
                          help="List of modules to exclude from coverage. "
                          "Supports wildcard matching at both start and "
                          "end. Example: *.core.dispatch.* "
                          "[NOSE_COVER_EXCLUDE]")
        parser.add_option("--cover3-inclusive", action="store_true",
                          dest="cover_inclusive",
                          default=env.get('NOSE_COVER_INCLUSIVE'),
                          help="Include all python files under working "
                          "directory in coverage report.  Useful for "
                          "discovering holes in test coverage if not all "
                          "files are imported by the test suite. "
                          "[NOSE_COVER_INCLUSIVE]")
        parser.add_option("--cover3-html", action="store_true",
                          default=env.get('NOSE_COVER_HTML'),
                          dest='cover_html',
                          help="Produce HTML coverage information")
        parser.add_option('--cover3-html-dir', action='store',
                          default=env.get('NOSE_COVER_HTML_DIR', 'cover'),
                          dest='cover_html_dir',
                          metavar='DIR',
                          help='Produce HTML coverage information in dir')
        parser.add_option('--cover3-xml', action='store_true',
                          default=env.get('NOSE_COVER_XML'),
                          dest='cover_xml',
                          help='Add Cobertura-style XML coverage reports')
        parser.add_option('--cover3-xml-file', action='store',
                          default=env.get('NOSE_COVER_XML_FILE'),
                          dest='cover_xml_file',
                          help='File to write XML coverage report.')
Example #21
0
    def options(self, parser, env):
        """
        Register command line options
        """
        parser.add_option("--marvin-config", action="store",
                          default=env.get('MARVIN_CONFIG', './datacenter.cfg'),
                          dest="config",
                          help="Marvin's configuration file where the " +
                               "datacenter information is specified " +
                               "[MARVIN_CONFIG]")
        parser.add_option("--result-log", action="store",
                          default=env.get('RESULT_LOG', None),
                          dest="result_log",
                          help="The path to the results file where test " +
                               "summary will be written to [RESULT_LOG]")
        parser.add_option("--client-log", action="store",
                          default=env.get('DEBUG_LOG', 'debug.log'),
                          dest="debug_log",
                          help="The path to the testcase debug logs " +
                          "[DEBUG_LOG]")
        parser.add_option("--load", action="store_true", default=False,
                          dest="load",
                          help="Only load the deployment configuration given")

        Plugin.options(self, parser, env)
Example #22
0
    def configure(self, options, noseconfig):
        """ Call the super and then validate and call the relevant parser for
        the configuration file passed in """
        if not options.testconfig:
            return
        Plugin.configure(self, options, noseconfig)

        self.config = noseconfig
        if not options.capture:
            self.enabled = False
        if options.testconfigformat:
            self.format = options.testconfigformat
            if self.format not in self.valid_loaders.keys():
                raise Exception('%s is not a valid configuration file format' \
                                                                % self.format)

        # Load the configuration file:
        self.valid_loaders[self.format](options.testconfig)

        if options.overrides:
            self.overrides = []
            overrides = tolist(options.overrides)
            for override in overrides:
                keys, val = override.split(":")
                if options.exact:
                    config[keys] = val
                else:                    
                    ns = ''.join(['["%s"]' % i for i in keys.split(".") ])
                    # BUG: Breaks if the config value you're overriding is not
                    # defined in the configuration file already. TBD
                    exec('config%s = "%s"' % (ns, val))
Example #23
0
 def options(self, parser, env):
     """
     Register command line options
     """
     parser.add_option("--marvin-config", action="store",
                       default=env.get('MARVIN_CONFIG',
                                       './datacenter.cfg'),
                       dest="configFile",
                       help="Marvin's configuration file is required."
                            "The config file containing the datacenter and "
                            "other management server "
                            "information is specified")
     parser.add_option("--deploy", action="store_true",
                       default=False,
                       dest="deployDc",
                       help="Deploys the DC with Given Configuration."
                            "Requires only when DC needs to be deployed")
     parser.add_option("--zone", action="store",
                       default=None,
                       dest="zone",
                       help="Runs all tests against this specified zone")
     parser.add_option("--hypervisor", action="store",
                       default=None,
                       dest="hypervisor_type",
                       help="Runs all tests against the specified "
                            "zone and hypervisor Type")
     parser.add_option("--log-folder-path", action="store",
                       default=None,
                       dest="logFolder",
                       help="Collects all logs under the user specified"
                            "folder"
                       )
     Plugin.options(self, parser, env)
Example #24
0
 def __init__(self):
     self.__identifier = None
     self.__testClient = None
     self.__logFolderPath = None
     self.__parsedConfig = None
     '''
     Contains Config File
     '''
     self.__configFile = None
     '''
     Signifies the Zone against which all tests will be Run
     '''
     self.__zoneForTests = None
     '''
     Signifies the flag whether to deploy the New DC or Not
     '''
     self.__deployDcFlag = None
     self.conf = None
     self.__resultStream = stdout
     self.__testRunner = None
     self.__testResult = SUCCESS
     self.__startTime = None
     self.__testName = None
     self.__tcRunLogger = None
     self.__testModName = ''
     self.__hypervisorType = None
     '''
     The Log Path provided by user where all logs are routed to
     '''
     self.__userLogPath = None
     Plugin.__init__(self)
Example #25
0
 def options(self, parser, env):
     """Sets additional command line options."""
     Plugin.options(self, parser, env)
     parser.add_option(
         '--tddium-output-file', action='store',
         dest='tddium_output_file', metavar="FILE",
         default=env.get('TDDIUM_OUTPUT_FILE', 'tddium_output.json'))
 def options(self, parser, env):
    """
    Sets additional command line options.
    """
    Plugin.options(self, parser, env)
    parser.add_option(
       '--gc-per-context', action = 'store_true', dest = 'gc_per_context',
       default = env.get('NOSE_GC_PER_CONTEXT', self._gcPerCtxt),
       help = ("Perform garbage collection after each context. "
               "Default is %s [NOSE_GC_PER_CONTEXT]" % self._gcPerCtxt)
    )
    parser.add_option(
       '--gc-per-directory', action = 'store_true', dest = 'gc_per_directory',
       default = env.get('NOSE_GC_PER_DIRECTORY', self._gcPerDir),
       help = ("Perform garbage collection after each directory. "
               "Default %is s [NOSE_GC_PER_DIRECTORY]" % self._gcPerDir)
    )
    parser.add_option(
       '--gc-per-test', action = 'store_true', dest = 'gc_per_test',
       default = env.get('NOSE_GC_PER_TEST', self._gcPerTest),
       help = ("Perform garbage collection after each test. This can be VERY slow! "
               "Default is %s [NOSE_GC_PER_TEST]" % self._gcPerTest)
    )
    parser.add_option(
       '--gc-gen', action = 'store', dest = 'gc_gen',
       default = env.get('NOSE_GC_GEN', self._gen),
       help = "Garbage collection generation to run. Default is %d [NOSE_GC_GEN]" % self._gen
    )
Example #27
0
    def configure(self, options, config):
        Plugin.configure(self, options, config)
        if not self.enabled:
            return

        self.verbosity = options.verbosity
        if options.quickunit_prefix:
            self.prefixes = options.quickunit_prefix
            if len(self.prefixes) == 1:
                self.prefixes = self.prefixes[0].split('\n')
        else:
            self.prefixes = ["tests/"]
        self.parent = 'master'

        self.logger = logging.getLogger(__name__)

        # pending files becomes a set of directorie pieces that represent
        # the file locations changed in this diff
        # for example, if /foo/bar/baz.py was changed, pending files would contain
        # set([('foo', 'bar', 'baz')])
        self.pending_files = set()

        # diff is a mapping of filename->set(linenos)
        self.diff_data = defaultdict(set)

        # store a list of filenames that should be accepted
        self.file_cache = FileAcceptedCache(self.prefixes, self.pending_files,
                                            self.diff_data)
Example #28
0
 def options(self, parser, env):
     """
     Register command line options
     """
     parser.add_option("--marvin-config", action="store",
                       default=env.get('MARVIN_CONFIG',
                                       './datacenter.cfg'),
                       dest="configFile",
                       help="Marvin's configuration file is required."
                            "The config file containing the datacenter and "
                            "other management server "
                            "information is specified")
     parser.add_option("--deploy", action="store_true",
                       default=False,
                       dest="deployDc",
                       help="Deploys the DC with Given Configuration."
                            "Requires only when DC needs to be deployed")
     parser.add_option("--zone", action="store",
                       default=None,
                       dest="zone",
                       help="Runs all tests against this specified zone")
     parser.add_option("--hypervisor", action="store",
                       default=None,
                       dest="hypervisor_type",
                       help="Runs all tests against the specified "
                            "zone and hypervisor Type")
     parser.add_option("--log-folder-path", action="store",
                       default=None,
                       dest="logFolder",
                       help="Collects all logs under the user specified"
                            "folder"
                       )
     Plugin.options(self, parser, env)
Example #29
0
    def __init__(self):
        self.__identifier = None
        self.__testClient = None
        self.__logFolderPath = None
        self.__parsedConfig = None
        '''
        Contains Config File
        '''
        self.__configFile = None
        '''
        Signifies the Zone against which all tests will be Run
        '''
        self.__zoneForTests = None
        '''
        Signifies the flag whether to deploy the New DC or Not
        '''
        self.__deployDcFlag = None
        self.conf = None
        self.__resultStream = stdout
        self.__testRunner = None
        self.__testResult = SUCCESS
        self.__startTime = None
        self.__testName = None
        self.__tcRunLogger = MarvinLog('marvin').get_logger()
        self.__testModName = ''
        self.__hypervisorType = None

        self.__halt_on_failure = False

        Plugin.__init__(self)
Example #30
0
    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
        if options.doctestOptions:
            flags = ",".join(options.doctestOptions).split(',')
            for flag in flags:
                try:
                    if flag.startswith('+'):
                        self.optionflags |= doctest.OPTIONFLAGS_BY_NAME[
                            flag[1:]]
                    elif flag.startswith('-'):
                        self.optionflags &= ~doctest.OPTIONFLAGS_BY_NAME[
                            flag[1:]]
                    else:
                        raise ValueError(
                            "Must specify doctest options with starting " +
                            "'+' or '-'.  Got %s" % (flag, ))
                except (AttributeError, KeyError):
                    raise ValueError("Unknown doctest option %s" %
                                     (flag[1:], ))
Example #31
0
    def options(self, parser, env):
        """
        Register command line options
        """
        parser.add_option("--marvin-config", action="store",
                          default=env.get('MARVIN_CONFIG', './datacenter.cfg'),
                          dest="config",
                          help="Marvin's configuration file where the " +
                               "datacenter information is specified " +
                               "[MARVIN_CONFIG]")
        parser.add_option("--result-log", action="store",
                          default=env.get('RESULT_LOG', None),
                          dest="result_log",
                          help="The path to the results file where test " +
                               "summary will be written to [RESULT_LOG]")
        parser.add_option("--client-log", action="store",
                          default=env.get('DEBUG_LOG', 'debug.log'),
                          dest="debug_log",
                          help="The path to the testcase debug logs " +
                          "[DEBUG_LOG]")
        parser.add_option("--load", action="store_true", default=False,
                          dest="load",
                          help="Only load the deployment configuration given")

        Plugin.options(self, parser, env)
Example #32
0
 def options(self, parser, env=os.environ):
     Plugin.options(self, parser, env)
     parser.add_option("--cover-package", action="append",
                       default=env.get('NOSE_COVER_PACKAGE'),
                       dest="cover_packages",
                       help="Restrict coverage output to selected packages "
                       "[NOSE_COVER_PACKAGE]")
     parser.add_option("--cover-erase", action="store_true",
                       default=env.get('NOSE_COVER_ERASE'),
                       dest="cover_erase",
                       help="Erase previously collected coverage "
                       "statistics before run")
     parser.add_option("--cover-tests", action="store_true",
                       dest="cover_tests",
                       default=env.get('NOSE_COVER_TESTS'),
                       help="Include test modules in coverage report "
                       "[NOSE_COVER_TESTS]")
     parser.add_option("--cover-inclusive", action="store_true",
                       dest="cover_inclusive",
                       default=env.get('NOSE_COVER_INCLUSIVE'),
                       help="Include all python files under working "
                       "directory in coverage report.  Useful for "
                       "discovering holes in test coverage if not all "
                       "files are imported by the test suite. "
                       "[NOSE_COVER_INCLUSIVE]")
Example #33
0
 def options(self, parser, env):
     browsers = Browser.get_supported_browsers()
     parser.add_option('-b', '--browser',
                       help="Specify browser by using initials. " \
                            "If value was not passed then 'ff' will be used. " \
                            "Supported choices: %s" % browsers,
                       choices=browsers)
     Plugin.options(self, parser, env)
 def __init__(self):
     Plugin.__init__(self)
     self.param = None
     self.lcov_bin = None
     self.lcov_data = None
     self.lcov_out = None
     self.lcov_utils = None
     self.genhtml_bin = None
Example #35
0
 def configure(self, options, config):
     Plugin.configure(self, options, config)
     alfajor_options = {}
     for key, value in vars(options).iteritems():
         if key.startswith('alfajor_'):
             short = key[len('alfajor_'):]
             alfajor_options[short] = value
     self.options = alfajor_options
Example #36
0
 def configure(self, options, config):
     """Configures the plugin."""
     Plugin.configure(self, options, config)
     self.config = config
     if self.enabled:
         self.output_file = options.tddium_output_file
         self.byfile = {}
         self.basepath = os.path.abspath('.') + '/'
Example #37
0
File: nose.py Project: iffy/alfajor
 def configure(self, options, config):
     Plugin.configure(self, options, config)
     alfajor_options = {}
     for key, value in vars(options).iteritems():
         if key.startswith('alfajor_'):
             short = key[len('alfajor_'):]
             alfajor_options[short] = value
     self.options = alfajor_options
Example #38
0
 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")
Example #39
0
 def options(self, parser, env=os.environ):
     Plugin.options(self, parser, env)
     # Test doctests in 'test' files / directories. Standard plugin default
     # is False
     self.doctest_tests = True
     # Variable name; if defined, doctest results stored in this variable in
     # the top-level namespace.  None is the standard default
     self.doctest_result_var = None
Example #40
0
 def __init__(self):
     Plugin.__init__(self)
     self.param = None
     self.lcov_bin = None
     self.lcov_data = None
     self.lcov_out = None
     self.lcov_utils = None
     self.genhtml_bin = None
Example #41
0
 def configure(self, options, config):
     Plugin.configure(self, options, config)
     self.doctest_tests = options.doctest_tests
     try:
         self.extension = tolist(options.doctestExtension)
     except AttributeError:
         # 2.3, no other-file option
         self.extension = None
Example #42
0
 def configure(self, options, config):
     """Configures the plugin."""
     Plugin.configure(self, options, config)
     self.config = config
     if self.enabled:
         self.output_file = options.tddium_output_file
         self.byfile = {}
         self.basepath = os.path.abspath('.') + '/'
Example #43
0
 def add_options(self, parser, env=os.environ):
     log.debug('Adding options on Bitten plug')
     Plugin.add_options(self, parser, env)
     parser.add_option(
         '--xml-results', action='store', dest='xml_results',
         metavar='FILE', help='write XML test results to FILE. Default: %default',
         default=os.path.join(os.getcwd(), 'build', 'test-results.xml')
     )
Example #44
0
 def options(self, parser, env=os.environ):
     Plugin.options(self, parser, env)
     # Test doctests in 'test' files / directories. Standard plugin default
     # is False
     self.doctest_tests = True
     # Variable name; if defined, doctest results stored in this variable in
     # the top-level namespace.  None is the standard default
     self.doctest_result_var = None
Example #45
0
    def configure(self, options, conf):

        Plugin.configure(self, options, conf)
        self.pattern = options.pattern
        if options.verbosity >= 2:
            self.verbose = True
            if self.enabled:
                err.write("Pattern for matching test methods is %s\n" % self.pattern)
Example #46
0
 def add_options(self, parser, env=os.environ):
     Plugin.add_options(self, parser, env)
     parser.add_option(
         '--xml-coverage', action='store', dest='xml_coverage',
         metavar='FILE', help='write XML coverage results to FILE. Default: %default',
         default=os.path.join(os.getcwd(), 'build', 'coverage-results.xml')
     )
     self.parser = parser
Example #47
0
 def options(self, parser, env):
     browsers = Browser.get_supported_browsers()
     parser.add_option('-b',
                       '--browser',
                       help="Specify browser by using initials. "
                       "If value was not passed then 'ff' will be used. "
                       "Supported choices: %s" % browsers,
                       choices=browsers)
     Plugin.options(self, parser, env)
Example #48
0
 def options(self, parser, env):
     """Sets additional command line options."""
     Plugin.options(self, parser, env)
     parser.add_option('--tddium-output-file',
                       action='store',
                       dest='tddium_output_file',
                       metavar="FILE",
                       default=env.get('TDDIUM_OUTPUT_FILE',
                                       'tddium_output.json'))
 def options(self, parser, env):
     """Register commandline options."""
     Plugin.options(self, parser, env)
     parser.add_option(
         "--ss-errors-only", action="store_true", dest="debugErrors",
         default=False, help="Screenshot errors but not failures")
     parser.add_option(
         "--ss-failures-only", action="store_true", dest="debugFailures",
         default=False, help="Screenshot failures but not errors")
 def configure(self, options, config):
     """Configure which kinds of failures trigger plugin."""
     Plugin.configure(self, options, config)
     self.config = config
     if self.enabled:
         if options.debugFailures and options.debugErrors:
             raise ValueError("--errors-only and --failures-only are mutually exclusive")
         self.enabled_for_errors = not options.debugFailures
         self.enabled_for_failures = not options.debugErrors
Example #51
0
 def configure(self, options, config):
     Plugin.configure(self, options, config)
     self.doctest_tests = options.doctest_tests
     try:
         self.extension = tolist(options.doctestExtension)
     except AttributeError:
         # 2.3, no other-file option
         self.extension = None
     self.finder = doctest.DocTestFinder()
Example #52
0
 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()
Example #53
0
 def options(self, parser, env):
     Plugin.options(self, parser, env)
     parser.add_option('--html-file',
                       action='store',
                       dest='html_file',
                       default=env.get('NOSE_HTML_FILE',
                                       'test_report.html'),
                       metavar="FILE",
                       help="HTML log file name")
Example #54
0
 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()
Example #55
0
 def __init__(self):
     Plugin.__init__(self)
     self.tags_to_check = []
     self.tags = []
     self.eval_tags = []
     self.tags_info = False
     self.list_tags = False
     self.verbose = False
     self.matched = {}
     self._test_marker = 'test_'
Example #56
0
 def options(self, parser, env):
     """Sets additional command line options."""
     Plugin.options(self, parser, env)
     parser.add_option(
         '--xunit-file', action='store',
         dest='xunit_file', metavar="FILE",
         default=env.get('NOSE_XUNIT_FILE', 'nosetests.xml'),
         help=("Path to xml file to store the xunit report in. "
               "Default is nosetests.xml in the working directory "
               "[NOSE_XUNIT_FILE]"))
Example #57
0
 def options(self, parser, env):
     """Sets additional command line options."""
     Plugin.options(self, parser, env)
     parser.add_option(
         '--xunit-file', action='store',
         dest='xunit_file', metavar="FILE",
         default=env.get('NOSE_XUNIT_FILE', 'nosetests.xml'),
         help=("Path to xml file to store the xunit report in. "
               "Default is nosetests.xml in the working directory "
               "[NOSE_XUNIT_FILE]"))