def configure(self, options, conf): Plugin.configure(self, options, conf) if not self.enabled: return ICPlugin.hostname = options.hostname ICPlugin.username = options.username ICPlugin.password = options.password ICPlugin.rest_session = idigi_rest_api.rest_session( options.hostname, auth=(options.username, options.password), verify=False, timeout=120) ICPlugin.session = requests.session(auth=(options.username, options.password), verify=False, timeout=120) ICPlugin.admin_session = requests.session(auth=('testbed', 'Sa!test11'), verify=False) ICPlugin.push_client = idigi_monitor_api.push_client( options.username, options.password, hostname=options.hostname, secure=False) ICPlugin.device_id = options.device_id ICPlugin.device_type = options.device_type ICPlugin.vendor_id = options.vendor_id ICPlugin.ipaddr = options.ipaddr ICPlugin.configuration = options.configuration
def configure(self, options, config): '''Configure the plug in''' # Call super Plugin.configure(self, options, config) # --------------------------------------------------------------------- # NOSE # --------------------------------------------------------------------- # Store the configuration self.config = config # Check if processes enabled try: self.fork = 1 != max(int(options.multiprocess_workers), 1) # If multiprocess not available except: self.fork = False # --------------------------------------------------------------------- # CORE # --------------------------------------------------------------------- # Store test target folder self.core_target = os.path.abspath(options.core_target) # Store source folder if options.source: self.source = os.path.abspath(options.source) else: self.source = None # Check if has to search sources self.search_source = options.search_source # Check if has to search tests self.search_test = options.search_test
def configure(self, options, conf): """Configure the plugin""" Plugin.configure(self, options, conf) for setting_str in options.env: env_variable, value = setting_str.split('=') os.environ[env_variable] = value
def configure(self, options, config): """Configures the xunit plugin.""" Plugin.configure(self, options, config) self.config = config if self.enabled: self.jinja = Environment( loader=FileSystemLoader(os.path.dirname( options.html_template)), trim_blocks=True, # AT Commented: lstrip_blocks=True ) self.stats = { 'errors': 0, 'failures': 0, 'passes': 0, 'skipped': 0 } self.report_data = defaultdict(Group) htmlfile_dirname = os.path.dirname(options.html_file) if htmlfile_dirname and not os.path.exists(htmlfile_dirname): # if not os.path.exists(htmlfile_dirname): os.makedirs(htmlfile_dirname) self.report_file = codecs.open(options.html_file, 'w', self.encoding, 'replace') self.report_template_filename = options.html_template
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)
def configure(self, options, config): """Configures the xunit plugin. :param config: :param options: """ Plugin.configure(self, options, config) if self.enabled: self.stats = {'total': 0, 'pass': 0, 'fail': 0, 'error': 0} self.pass_report_string = '' self.fail_report_string = '' self.err_report_string = '' self.report_string = '\n ' + '-' * 159 self.report_string += "\n|{:^40}|{:^10}|{:^20}|{:^86}|".format( 'Test', 'Result', 'RunTime(sec)', 'Reason') self.report_string += '\n ' + '-' * 159 self.config = config if self.enabled: self.archive_loc = os.path.realpath(options.autopsy_summary_file) self.log_file_name = self.archive_loc + "/summary.txt" self.mailto = options.mailto # self.sortTestCasesByName() autopsy_globals.dumpTestCaseJsonFile()
def configure(self, options, conf): Plugin.configure(self, options, conf) if self.enabled: if options.config_file: self.read_config_file(options.config_file) else: self.set_options(options)
def configure(self, options, conf): """ Configure plugin. """ Plugin.configure(self, options, conf) self.classes_to_look_at = [] if options.randomize: self.enabled = True if options.seed is not None: self.seed = options.seed random.seed(self.seed) if options.class_specific: self.class_specific = True if options.seed is not None and not options.class_specific: print("Using %d as seed" % (self.seed, )) if options.seed is not None and options.class_specific: self.class_specific = False print( 'NOTE: options --seed and --class-specific conflict, ' 'Specific class randomization ignored, seed %d will be used.' % (self.seed, ))
def configure(self, options, config): # Configure Plugin.configure(self, options, config) # Set options if options.enable_plugin_specplugin: options.verbosity = max(options.verbosity, 2) self.spec_doctests = options.spec_doctests # Color setup for label, color in list({ 'error': 'red', 'ok': 'green', 'deprecated': 'yellow', 'skipped': 'yellow', 'failure': 'red', 'identifier': 'cyan', 'file': 'blue', }.items()): # No color: just print() really func = lambda text, bold=False: text if not options.no_spec_color: # Color: colorizes! func = partial(colorize, color) # Store in dict (slightly quicker/nicer than getattr) self.color[label] = func # Add attribute for easier hardcoded access setattr(self, label, func)
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 mothods is %s\n" % self.pattern)
def configure(self, options, conf): """ Called after the command line has been parsed, with the parsed options and the config container. Here, implement any config storage or changes to state or operation that are set by command line options. DO NOT return a value from this method unless you want to stop all other plugins from being configured. """ Plugin.configure(self, options, conf) connection.use_debug_cursor = True
def configure(self, options, conf): """Configure the plugin based on provided options""" Plugin.configure(self, options, conf) if options.show_each_error: self.show_each_error = True if options.show_each_failure: self.show_each_failure = True
def configure(self, options, conf): log.debug("Configuring PSCTest2NosePlugin") Plugin.configure(self, options, conf) self.conf = conf if hasattr(self.conf.options, 'collect_only'): self.collect_only = getattr(self.conf.options, 'collect_only') log.debug("self.collect_only is %s" % self.collect_only) self.buildConfig = getattr(self.conf.options, 'build_config') if hasattr(self.conf.options, 'build_config') else None
def configure(self, options, config): Plugin.configure(self, options, config) self.config = config if not self.enabled: return self._sink = Sink()
def configure(self, options, conf): Plugin.configure(self, options, conf) conf.exclude = map(re.compile, tolist(r'^(manage\.py|.*settings\.py|apps)$')) if options.django_settings and self.env is not None: self.env['DJANGO_SETTINGS_MODULE'] = options.django_settings self.verbosity = conf.verbosity
def configure(self, options, conf): self.hash_file = join(conf.workingDir, self.hash_file) if isfile(self.hash_file): log.debug("Loading last known hashes and dependency graph") with open(self.hash_file, 'r') as f: data = load(f) self._known_hashes = data['hashes'] self._known_graph = data['graph'] Plugin.configure(self, options, conf)
def configure(self, options, config): global HTTP_PORT, SELENIUM_GRID_PORT Plugin.configure(self, options, config) HTTP_PORT = options.HTTP_PORT SELENIUM_GRID_PORT = options.SELENIUM_GRID_PORT self.browsers = options.browsers self.enabled = True
def configure(self, options, config): Plugin.configure(self, options, config) #== if not self.enabled: return #== self.report_path = options.report_file if options.template_file: self.html_path, self.template_path = os.path.split(options.template_file)
def configure(self, options, conf): Plugin.configure(self, options, conf) self.stream = None self.enabled = True self.has_failed_tests = False self.good_tests = [ ] self.function_calls = { } self.calls = { } self.app_paths = filter(bool, map(normalize_path, options.mutant_path or [ ])) self.exclude_paths = filter(bool, map(normalize_path, options.mutant_exclude or [ ]))
def configure(self, options, config): """Configures the xunit plugin.""" Plugin.configure(self, options, config) self.config = config self.report_file_name = options.report_file #added code self.logformat = options.logcapture_format self.logdatefmt = options.logcapture_datefmt self.clear = options.logcapture_clear self.loglevel = options.logcapture_level
def configure(self, options, config): Plugin.configure(self, options, config) #== if not self.enabled: return #== self.report_path = options.report_file if options.template_file: self.html_path, self.template_path = os.path.split( options.template_file)
def configure(self, options, conf): Plugin.configure(self, options, conf) import testing, requires testing.db = db testing.requires = requires # Lazy setup of other options (post coverage) for fn in post_configure: fn(options, file_config)
def configure(self, options, conf): log.debug("Configuring PSCTest2NosePlugin") Plugin.configure(self, options, conf) self.conf = conf if hasattr(self.conf.options, 'collect_only'): self.collect_only = getattr(self.conf.options, 'collect_only') log.debug("self.collect_only is %s" % self.collect_only) self.buildConfig = getattr( self.conf.options, 'build_config') if hasattr( self.conf.options, 'build_config') else None
def configure(self, options, config): Plugin.configure(self, options, config) self.doctest_tests = options.doctest_tests self.extension = tolist(options.doctestExtension) self.parser = doctest.DocTestParser() self.finder = DocTestFinder() self.checker = IPDoctestOutputChecker() self.globs = None self.extraglobs = None
def configure(self, options, conf): self.hash_file = os.path.join(conf.workingDir, self.hash_file) if os.path.isfile(self.hash_file): log.debug("Loading last known hashes and dependency graph") f = open(self.hash_file, 'r') data = load(f) f.close() self._known_hashes = data['hashes'] self._known_graph = data['graph'] Plugin.configure(self, options, conf)
def configure(self, options, conf): Plugin.configure(self, options, conf) if self.enabled: # browser-help is a usage call if getattr(options, 'browser_help'): self._browser_help() # get options from command line or config file if options.config_file: self.ingest_config_file(options.config_file) else: self.ingest_options(options) ### Validation ### # local if BROWSER_LOCATION == 'local': self._check_validity(BROWSER, self._valid_browsers_for_local) # sauce elif BROWSER_LOCATION == 'sauce': valid_browsers_for_sauce, valid_oses_for_sauce, combos = self._get_sauce_options( ) if not SAUCE_USERNAME or not SAUCE_APIKEY: raise TypeError( "'sauce' value for --browser-location " "requires --sauce-username and --sauce-apikey.") self._check_validity(BROWSER, valid_browsers_for_sauce) if not OS: raise TypeError( "'sauce' value for --browser-location requires the --os option." ) self._check_validity(OS, valid_oses_for_sauce, flag="--os") # remote elif BROWSER_LOCATION == 'remote': self._check_validity(BROWSER, self._valid_browsers_for_remote) if not REMOTE_ADDRESS: raise TypeError( "'remote' value for --browser-location requires --remote-address." ) # grid elif BROWSER_LOCATION == 'grid': self._check_validity(BROWSER, self._valid_browsers_for_remote) if not REMOTE_ADDRESS: raise TypeError( "'grid' value for --browser-location requires --grid-address." ) if not OS: raise TypeError( "'grid' value for --browser-location requires the --os option." )
def configure(self, options, conf): """ Configure plugin. """ Plugin.configure(self, options, conf) if options.randomize: self.enabled = True if options.seed is not None: self.seed = options.seed random.seed(self.seed) print("Using %d as seed" % (self.seed,))
def configure(self, options, config): #print "Configuring nose plugin:", self.name # dbg Plugin.configure(self, options, config) self.doctest_tests = options.ipdoctest_tests self.extension = tolist(options.ipdoctest_extension) self.parser = IPDocTestParser() self.finder = DocTestFinder(parser=self.parser) self.checker = IPDoctestOutputChecker() self.globs = None self.extraglobs = None
def configure(self, options, config): Plugin.configure(self, options, config) if options.enable_plugin_spec: options.verbosity = max(options.verbosity, 2) if options.spec_color: self._colorize = lambda color: lambda text: in_color(color, text) else: self._colorize = lambda color: lambda text: text self.spec_doctests = options.spec_doctests
def configure(self, options, conf): Plugin.configure(self, options, conf) self.stream = None self.enabled = True self.has_failed_tests = False self.good_tests = [] self.function_calls = {} self.calls = {} self.app_paths = filter(bool, map(normalize_path, options.mutant_path or [])) self.exclude_paths = filter( bool, map(normalize_path, options.mutant_exclude or []))
def configure(self, options, conf): """Set the configuration""" if options.lettuce_path: self._base_path = options.lettuce_path else: self._base_path = os.path.join(conf.workingDir, "features") conf.lettuce_verbosity = options.lettuce_verbosity conf.lettuce_scenarios = options.lettuce_scenarios Plugin.configure(self, options, conf)
def configure(self, options, config): Plugin.configure(self, options, config) # Pull standard doctest plugin out of config; we will do doctesting config.plugins.plugins = [p for p in config.plugins.plugins if p.name != "doctest"] self.doctest_tests = options.doctest_tests self.extension = tolist(options.doctestExtension) self.parser = doctest.DocTestParser() self.finder = DocTestFinder() self.checker = IPDoctestOutputChecker() self.globs = None self.extraglobs = None
def configure(self, options, config): """Configures the xunit plugin.""" Plugin.configure(self, options, config) self.config = config if self.enabled: self.jinja = Environment( loader=FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates')), trim_blocks=True, lstrip_blocks=True ) self.stats = {'errors': 0, 'failures': 0, 'passes': 0, 'skipped': 0} self.report_data = defaultdict(Group) self.report_file = codecs.open(options.html_file, 'w', self.encoding, 'replace')
def configure(self, options, config): Plugin.configure(self, options, config) if self.enabled: config.options.noSkip = True self.result = dict(summary={}, testcases=[]) self.result['summary'] = { 'errors': 0, 'failures': 0, 'passed': 0, 'skip': 0 } self.testsuite_name = options.html_testsuite_name self.output_file = options.html_file
def configure(self, options, config): Plugin.configure(self, options, config) # Pull standard doctest plugin out of config; we will do doctesting config.plugins.plugins = [p for p in config.plugins.plugins if p.name != 'doctest'] self.doctest_tests = options.doctest_tests self.extension = tolist(options.doctestExtension) self.parser = doctest.DocTestParser() self.finder = DocTestFinder() self.checker = IPDoctestOutputChecker() self.globs = None self.extraglobs = None
def configure(self, options, conf): Plugin.configure(self, options, conf) self.idfile = os.path.expanduser(options.testIdFile) if not os.path.isabs(self.idfile): self.idfile = os.path.join(conf.workingDir, self.idfile) self.id = 1 # Ids and tests are mirror images: ids are {id: test address} and # tests are {test address: id} self.ids = {} self.tests = {} # used to track ids seen when tests is filled from # loaded ids file self._seen = {}
def configure(self, options, config): #print "Configuring nose plugin:", self.name # dbg Plugin.configure(self, options, config) # Pull standard doctest plugin out of config; we will do doctesting config.plugins.plugins = [p for p in config.plugins.plugins if p.name != 'doctest'] self.doctest_tests = options.ipdoctest_tests self.extension = tolist(options.ipdoctest_extension) self.parser = IPDocTestParser() self.finder = DocTestFinder(parser=self.parser) self.checker = IPDoctestOutputChecker() self.globs = None self.extraglobs = None
def configure(self, options, conf): """ Called after the command line parser has been parsed. Errors if -r and -n are both set. """ Plugin.configure(self, options, conf) if not self.enabled: return self._write = not options.nwrite self._reg = options.regonly self._new = options.newonly self._settings = options.filename if self._reg and self._new: options.error("-r and -n are mutually exclusive")
def configure(self, options, conf): Plugin.configure(self, options, conf) if self.enabled: # browser-help is a usage call if getattr(options, 'browser_help'): self._browser_help() # get options from command line or config file if options.config_file: self.ingest_config_file(options.config_file) else: self.ingest_options(options) ### Validation ### # local if BROWSER_LOCATION == 'local': self._check_validity(BROWSER, self._valid_browsers_for_local) # sauce elif BROWSER_LOCATION == 'sauce': valid_browsers_for_sauce, valid_oses_for_sauce, combos = self._get_sauce_options() if not SAUCE_USERNAME or not SAUCE_APIKEY: raise TypeError("'sauce' value for --browser-location " "requires --sauce-username and --sauce-apikey.") self._check_validity(BROWSER, valid_browsers_for_sauce) if not OS: raise TypeError( "'sauce' value for --browser-location requires the --os option.") self._check_validity(OS, valid_oses_for_sauce, flag="--os") # remote elif BROWSER_LOCATION == 'remote': self._check_validity(BROWSER, self._valid_browsers_for_remote) if not REMOTE_ADDRESS: raise TypeError( "'remote' value for --browser-location requires --remote-address.") # grid elif BROWSER_LOCATION == 'grid': self._check_validity(BROWSER, self._valid_browsers_for_remote) if not REMOTE_ADDRESS: raise TypeError( "'grid' value for --browser-location requires --grid-address.") if not OS: raise TypeError( "'grid' value for --browser-location requires the --os option.")
def configure(self, options, conf): Plugin.configure(self, options, conf) if not self.enabled: return self.cflags = options.cflags self.src = options.src self.username = options.username self.password = options.password self.hostname = options.hostname self.device_type = options.device_type self.firmware_version = options.firmware_version self.config_tool_jar = options.config_tool_jar self.keystore = options.keystore
def configure(self, options, config): # This is only checked since this plugin is configured regardless if # the sshtunnel flag is used, and we only want this info here if the # --remote-server flag is used if options.remote_server: try: to_port, from_port = options.to_from_ports.split(':', 1) except: raise RuntimeError("--to_from_ports should be of the form x:y") else: self._to_port = to_port self._from_port = from_port self._remote_server = options.remote_server self._username = options.username Plugin.configure(self, options, config)
def configure(self, options, conf): if not self.can_configure: return Plugin.configure(self, options, conf) self.config = conf self.preload = options.preload #detailedErrors is defined in failuredetail plugin self.useDetails = getattr(options, "detailedErrors", self.useDetails) #multiprocess_workers defined in multiprocess plugin self.multiprocess_workers = getattr(options, "multiprocess_workers", self.multiprocess_workers)
def configure(self, options, conf): """Configure the plugin and system, based on selected options. The base plugin class sets the plugin to enabled if the enable option for the plugin (self.enableOpt) is true. """ Plugin.configure(self, options, conf) if not self.can_configure: return self.config = conf self.conf = conf if self.enabled == False: return
def configure(self, options, config): # print "Configuring nose plugin:", self.name # dbg Plugin.configure(self, options, config) # Pull standard doctest plugin out of config; we will do doctesting config.plugins.plugins = [ p for p in config.plugins.plugins if p.name != "doctest" ] self.doctest_tests = options.ipdoctest_tests self.extension = tolist(options.ipdoctest_extension) self.parser = IPDocTestParser() self.finder = DocTestFinder(parser=self.parser) self.checker = IPDoctestOutputChecker() self.globs = None self.extraglobs = None
def configure(self, options, config): Plugin.configure(self, options, config) self.config = config if not self.enabled: return self.stats = {'errors': 0, 'failures': 0, 'passes': 0, 'skipped': 0} self.results = [] report_output = options.json_file path = os.path.dirname(report_output) if not os.path.exists(path): os.makedirs(path) self.report_output = report_output
def configure(self, options, conf): Plugin.configure(self, options, conf) if self.enabled: # browser-help is a usage call if getattr(options, 'browser_help'): self._browser_help() # get options from command line or config file if options.config_file: self.ingest_config_file(options.config_file) else: self.ingest_options(options) self._check_validity(BROWSER, self._valid_browsers_for_local)
def configure(self, options, cfg): Plugin.configure(self, options, cfg) if not self.enabled: return conf_file = options.funq_conf = os.path.realpath(options.funq_conf) if not os.path.isfile(conf_file): raise Exception("Missing configuration file of funq: `%s`" % conf_file) conf = ConfigParser() conf.read([conf_file]) self.app_registry = ApplicationRegistry() self.app_registry.register_from_conf(conf, options) register_funq_app_registry(self.app_registry) self.trace_tests = options.funq_trace_tests self.trace_tests_encoding = \ options.funq_trace_tests_encoding self.screenshoter = ScreenShoter(options.funq_screenshot_folder) tools.SNOOZE_FACTOR = float(options.funq_snooze_factor) FunqPlugin._instance = self