Run tests marked with a particular tag and stage
8677
def _run_events(self, tag, stage=None):
        """"""

        self._run_event_methods(tag, stage)
        self._run_tests(tag, stage)
907928
def make_experiment_tag(orig_tag, config, mutations):
    """"""

    resolved_vars = {}
    for k in mutations.keys():
        resolved_vars[("config", k)] = config[k]
    return "{}@perturbed[{}]".format(orig_tag, format_vars(resolved_vars))
195386
def __generate(results):
        
        doc, tag, text = Doc().tagtext()

        # Counters for testsuite tag info
        count = 0
        fails = 0
        errors = 0
        skips = 0

        for result in results:
            # Loop through all results and count the ones that were not later retried.
            if result.passed() is False:
                if result.retries_left > 0:
                    # This will appear in the list again, move on
                    continue
            count += 1
            if result.passed():
                # Passed, no need to increment anything else
                continue
            elif result.skipped():
                skips += 1
            elif result.was_inconclusive():
                errors += 1
            else:
                fails += 1

        with tag('testsuite',
                 tests=str(count),
                 failures=str(fails),
                 errors=str(errors),
                 skipped=str(skips)):
            for result in results:
                if result.passed() is False and result.retries_left > 0:
                    continue
                class_name = result.get_tc_name()
                models = result.get_dut_models()
                if models:
                    class_name = class_name + "." + models
                name = result.get_toolchain()
                with tag('testcase', classname=class_name, name=name,
                         time=result.get_duration(seconds=True)):
                    if result.stdout:
                        with tag('system-out'):
                            text(result.stdout)
                    if result.passed():
                        continue
                    elif result.skipped():
                        with tag('skipped'):
                            text(result.skip_reason)
                    elif result.was_inconclusive():
                        with tag('error', message=hex_escape_str(result.fail_reason)):
                            text(result.stderr)
                    else:
                        with tag('failure', message=hex_escape_str(result.fail_reason)):
                            text(result.stderr)
        return indent(
            doc.getvalue(),
            indentation=' '*4
        )
38614
def _maybe_init_tags(self, run_id, tag_to_metadata):
    
    cursor = self._db.cursor()
    # TODO: for huge numbers of tags (e.g. 1000+), this is slower than just
    # querying for the known tag names explicitly; find a better tradeoff.
    cursor.execute('SELECT tag_name, tag_id FROM Tags WHERE run_id = ?',
                   (run_id,))
    tag_to_id = {row[0]: row[1] for row in cursor.fetchall()
                 if row[0] in tag_to_metadata}
    new_tag_data = []
    for tag, metadata in six.iteritems(tag_to_metadata):
      if tag not in tag_to_id:
        tag_id = self._create_id()
        tag_to_id[tag] = tag_id
        new_tag_data.append((run_id, tag_id, tag, time.time(),
                             metadata.display_name,
                             metadata.plugin_data.plugin_name,
                             self._make_blob(metadata.plugin_data.content)))
    cursor.executemany(
        """
        INSERT INTO Tags (
          run_id, tag_id, tag_name, inserted_time, display_name, plugin_name,
          plugin_data
        ) VALUES (?, ?, ?, ?, ?, ?, ?)
        """,
        new_tag_data)
    return tag_to_id
1049081
def tag(**tags):
    
    transaction = execution_context.get_transaction()
    if not transaction:
        error_logger.warning("Ignored tags %s. No transaction currently active.", ", ".join(tags.keys()))
    else:
        transaction.tag(**tags)
1030022
def run_tag_from_session_and_metric(session_name, metric_name):
  
  assert isinstance(session_name, six.string_types)
  assert isinstance(metric_name, api_pb2.MetricName)
  # os.path.join() will append a final slash if the group is empty; it seems
  # like multiplexer.Tensors won't recognize paths that end with a '/' so
  # we normalize the result of os.path.join() to remove the final '/' in that
  # case.
  run = os.path.normpath(os.path.join(session_name, metric_name.group))
  tag = metric_name.tag
  return run, tag
1114720
def RunMetadata(self, tag):
    
    if tag not in self._tagged_metadata:
      raise ValueError('There is no run metadata with this tag name')

    run_metadata = config_pb2.RunMetadata()
    run_metadata.ParseFromString(self._tagged_metadata[tag])
    return run_metadata
1219548
def do_tag(self, args: argparse.Namespace):
        """"""
        # The Namespace always includes the Statement object created when parsing the command line
        statement = args.__statement__

        self.poutput("The command line you ran was: {}".format(statement.command_and_args))
        self.poutput("It generated this tag:")
        self.poutput('<{0}>{1}</{0}>'.format(args.tag, ' '.join(args.content)))
1332898
def process(self):
        
        suites = None
        if isinstance(self.tree, ET.Element):
            root = self.tree
        else:
            root = self.tree.getroot()

        if root.tag == "testrun":
            root = root[0]

        if root.tag == "testsuite":
            suites = [root]

        if root.tag == "testsuites":
            suites = [x for x in root]

        assert suites, "could not find test suites in results xml"

        for suite in suites:
            cursuite = Suite()
            self.suites.append(cursuite)
            cursuite.name = suite.attrib["name"]
            if "package" in suite.attrib:
                cursuite.package = suite.attrib["package"]
            cursuite.duration = float(suite.attrib.get("time", '0').replace(',',''))

            for element in suite:
                if element.tag == "error":
                    # top level error?
                    errtag = {
                        "message": element.attrib.get("message", ""),
                        "type": element.attrib.get("type", ""),
                        "text": element.text
                    }
                    cursuite.errors.append(errtag)
                if element.tag == "system-out":
                    cursuite.stdout = element.text
                if element.tag == "system-err":
                    cursuite.stderr = element.text

                if element.tag == "properties":
                    for prop in element:
                        if prop.tag == "property":
                            cursuite.properties[prop.attrib["name"]] = prop.attrib["value"]

                if element.tag == "testcase":
                    testcase = element

                    if not testcase.attrib.get("classname", None):
                        testcase.attrib["classname"] = NO_CLASSNAME

                    if testcase.attrib["classname"] not in cursuite:
                        testclass = Class()
                        testclass.name = testcase.attrib["classname"]
                        cursuite[testclass.name] = testclass

                    testclass = cursuite[testcase.attrib["classname"]]
                    newcase = Case()
                    newcase.name = testcase.attrib["name"]
                    newcase.testclass = testclass
                    newcase.duration = float(testcase.attrib.get("time", '0').replace(',',''))
                    testclass.cases.append(newcase)

                    # does this test case have any children?
                    for child in testcase:
                        if child.tag == "skipped":
                            newcase.skipped = child.text
                            if "message" in child.attrib:
                                newcase.skipped_msg = child.attrib["message"]
                        elif child.tag == "system-out":
                            newcase.stdout = child.text
                        elif child.tag == "system-err":
                            newcase.stderr = child.text
                        elif child.tag == "failure":
                            newcase.failure = child.text
                            if "message" in child.attrib:
                                newcase.failure_msg = child.attrib["message"]
                        elif child.tag == "error":
                            newcase.failure = child.text
                            if "message" in child.attrib:
                                newcase.failure_msg = child.attrib["message"]
                        elif child.tag == "properties":
                            for property in child:
                                newproperty = Property()
                                newproperty.name = property.attrib["name"]
                                newproperty.value = property.attrib["value"]
                                newcase.properties.append(newproperty)
29840
private static String mergeTags(RoxableTest mAnnotation, RoxableTestClass cAnnotation) {
		List<String> tags = new ArrayList<>();
		
		if (mAnnotation != null) {
			tags.addAll(Arrays.asList(mAnnotation.tags()));
		}
		
		if (cAnnotation != null) {
			tags.addAll(Arrays.asList(cAnnotation.tags()));
		}

		return Arrays.toString(tags.toArray(new String[tags.size()]));
	}
730590
def tag_stuff(self):
        """"""

        # For each packet in the pcap process the contents
        for item in self.input_stream:

            # Make sure it has a tags field (which is a set)
            if 'tags' not in item:
                item['tags'] = set()

            # For each tag_methods run it on the item
            for tag_method in self.tag_methods:
                item['tags'].add(tag_method(item))

            # Not interested in None tags
            if None in item['tags']:
                item['tags'].remove(None)
            # All done
            yield item
276700
function (root, tagName) {
    return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
      return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
    });
  }
1187625
private TaskEvent getMatchStage(NodeTask nodeTask, StageType stage) {
        List<StageType> stages = nodeTask.getStage();
        List<TaskEvent> events = nodeTask.getEvent();

        for (int i = 0; i < stages.size(); i++) {
            if (stages.get(i) == stage) {
                return events.get(i);
            }

        }

        return null;
    }
41529
function matchTags(rule, runOnly) {
	'use strict';
	var include, exclude, matching;
	var defaultExclude =
		axe._audit && axe._audit.tagExclude ? axe._audit.tagExclude : [];

	// normalize include/exclude
	if (runOnly.hasOwnProperty('include') || runOnly.hasOwnProperty('exclude')) {
		// Wrap include and exclude if it's not already an array
		include = runOnly.include || [];
		include = Array.isArray(include) ? include : [include];

		exclude = runOnly.exclude || [];
		exclude = Array.isArray(exclude) ? exclude : [exclude];
		// add defaults, unless mentioned in include
		exclude = exclude.concat(
			defaultExclude.filter(function(tag) {
				return include.indexOf(tag) === -1;
			})
		);

		// Otherwise, only use the include value, ignore exclude
	} else {
		include = Array.isArray(runOnly) ? runOnly : [runOnly];
		// exclude the defaults not included
		exclude = defaultExclude.filter(function(tag) {
			return include.indexOf(tag) === -1;
		});
	}

	matching = include.some(function(tag) {
		return rule.tags.indexOf(tag) !== -1;
	});
	if (matching || (include.length === 0 && rule.enabled !== false)) {
		return exclude.every(function(tag) {
			return rule.tags.indexOf(tag) === -1;
		});
	} else {
		return false;
	}
}
410605
def validatetag(context):
    ""
    # Validate that a Git tag exists for the current commit HEAD
    result = context.run("git describe --exact-match --tags $(git log -n1 --pretty='%h')")
    tag = result.stdout.rstrip()

    # Validate that the Git tag appears to be a valid version number
    ver_regex = re.compile('(\d+)\.(\d+)\.(\d+)')
    match = ver_regex.fullmatch(tag)
    if match is None:
        print('Tag {!r} does not appear to be a valid version number'.format(tag))
        sys.exit(-1)
    else:
        print('Tag {!r} appears to be a valid version number'.format(tag))
1307464
def tags
      runner.tag_lists[decision_task.workflow_execution] ||= begin
        collision = 0
        begin
          decision_task.workflow_execution.tags
        rescue => e
          collision += 1 if collision < 10
          max_slot_delay = 2**collision - 1
          sleep(slot_time * rand(0 .. max_slot_delay))
          retry
        end
      end
    end
160923
def submit_tag_batch(self, batch):
        """"""
        url = '%s/api/v5/batch/tags' % self.base_url
        self._submit_batch(url, batch)