Place previously failed tests on a queue priority line, respecting the order they get assigned.
540043
function priorityFill( callback ) {
	var queue, prioritizedQueue;

	queue = config.queue.slice( priorityFill.pos );
	prioritizedQueue = config.queue.slice( 0, -config.queue.length + priorityFill.pos );

	queue.unshift( callback );
	queue.unshift.apply( queue, prioritizedQueue );

	config.queue = queue;

	priorityFill.pos += 1;
}
257649
public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time)
    {
        if (!$this->colors) {
            parent::addFailure($test, $e, $time);

            return;
        }

        $this->writeProgress(Coloring::red('F'));
        $this->lastTestFailed = true;
    }
1359589
private void addLineScreenCaptureForErrorEachStackLine(
            List<LineScreenCapture> lineScreenCaptures, RunFailure runFailure) {
        if (runFailure == null) {
            return; // do nothing
        }
        List<StackLine> failureLines = runFailure.getStackLines();
        int failureCaptureIndex = matchedLineScreenCaptureIndex(
                lineScreenCaptures, failureLines);
        if (failureCaptureIndex == -1) {
            return; // no failure capture
        }
        LineScreenCapture failureCapture = lineScreenCaptures.get(failureCaptureIndex);

        for (int i = 1; i < failureLines.size(); i++) {
            List<StackLine> errorEachStackLine = new ArrayList<>(failureLines.size() - i);
            for (int j = i; j < failureLines.size(); j++) {
                errorEachStackLine.add(failureLines.get(j));
            }

            LineScreenCapture newCapture = new LineScreenCapture();
            newCapture.setPath(failureCapture.getPath());
            newCapture.addAllStackLines(errorEachStackLine);

            int errEachStackLineCaptureIndex
            = matchedLineScreenCaptureIndex(lineScreenCaptures, errorEachStackLine);
            if (errEachStackLineCaptureIndex == -1) {
                lineScreenCaptures.add(newCapture);
            } else {
                lineScreenCaptures.set(errEachStackLineCaptureIndex, newCapture);
            }
        }
    }
1121569
public void keepTopNElements(int N){
        PriorityQueue<Pair<T, Double>> queue = asPriorityQueue();
        clear();
        for (int e = 0; e < N; e++) {
            Pair<T, Double> pair = queue.poll();
            if (pair != null)
                incrementCount(pair.getFirst(), pair.getSecond());
        }
    }
156823
public function reset() {
		parent::reset();
		$this->_priority = null;
		$this->_wrapLength = null;

		$this->_error = null;
		$this->_debug = null;
	}
1184404
def enqueue item, priority=0
      raise RangeError.new("priority #{priority} is greater than queue size") if priority > self.size
      @array.push PQNode.new(item, priority)
      @array.sort! { |a, b| a.priority <=> b.priority }
    end
293387
def handleError(self, test, err, capt=None):
        
        if err[0] == errors.BlockedTest:
            self.__insert_test_result(constants.State.BLOCKED, test, err)
            self.error_handled = True
            raise SkipTest(err[1])
            return True

        elif err[0] == errors.DeprecatedTest:
            self.__insert_test_result(constants.State.DEPRECATED, test, err)
            self.error_handled = True
            raise SkipTest(err[1])
            return True

        elif err[0] == errors.SkipTest:
            self.__insert_test_result(constants.State.SKIP, test, err)
            self.error_handled = True
            raise SkipTest(err[1])
            return True
1189788
def maybe_put_task(self):
        """"""
        try:
            task = next(self.tasks)
        except StopIteration:
            pass
        else:
            log.debug('Putting %s on queue', task)
            self.task_queue.put(task)
949907
def requeue_delayed_jobs(self):
        
        failures = []
        for queue in self.queue_model.get_all_by_priority(self.queues):
            failures.extend(queue.requeue_delayed_jobs())

        self.last_requeue_delayed = datetime.utcnow()

        for failure in failures:
            self.log('Unable to requeue %s: %s' % failure)
288417
def addFailure(self, result):
        """"""
        result.addFailure(self, (Exception, Exception(), None))
        # Since TAP will not provide assertion data, clean up the assertion
        # section so it is not so spaced out.
        test, err = result.failures[-1]
        result.failures[-1] = (test, "")
426365
function() {
      while (JSLitmus._queue.length) {
        var test = JSLitmus._queue.shift();
        JSLitmus.renderTest(test);
      }
    }
1010878
def put(self, iocb):
        """"""
        if _debug: IOQueue._debug("put %r", iocb)

        # requests should be pending before being queued
        if iocb.ioState != PENDING:
            raise RuntimeError("invalid state transition")

        # save that it might have been empty
        wasempty = not self.notempty.isSet()

        # add the request to the end of the list of iocb's at same priority
        priority = iocb.ioPriority
        item = (priority, iocb)
        self.queue.insert(bisect_left(self.queue, (priority+1,)), item)

        # point the iocb back to this queue
        iocb.ioQueue = self

        # set the event, queue is no longer empty
        self.notempty.set()

        return wasempty
862309
function(test) {
			var context = this.loopContext;
			var forkContext = this.forkContext;

			context.test = test;

			// Creates paths of `continue` statements.
			if (!context.continueForkContext.empty) {
				context.continueForkContext.add(forkContext.head);
				var testSegments = context.continueForkContext.makeNext(0, -1);

				forkContext.replaceHead(testSegments);
			}
		}
420691
def postinit(self, test=None, fail=None):
        
        self.fail = fail
        self.test = test
485230
public function addFailure(Test $test, AssertionFailedError $failure, float $time): void
    {
        if ($test instanceof TestCase and $test->is_driver_active() and $test->driver()->is_page_active()) {
            $this->save_driver_content(
                $test->driver(),
                \get_class($test).'_'.$test->getName(false),
                $failure->getMessage()
            );
        }
    }
978517
def addfirst(self, item, new_priority=None):
        """"""

        with self.lock:

            self_data = self.data

            try:
                priority = self_data[0][1]
                if new_priority is not None:
                    if new_priority < priority:
                        raise ValueError('Priority must be >= '
                                         'highest priority.')
                    else:
                        priority = new_priority
            except IndexError:
                priority = 0 if new_priority is None else new_priority

            self_data.appendleft((item, priority))
            self_items = self.items
            maxlen = self._maxlen

            try:
                self_items[item] += 1
            except TypeError:
                self_items[repr(item)] += 1

            if maxlen is not None and maxlen < len(self_data):
                self._poplast()
389405
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
    {
        $this->doAddFault($test, $e, $time, 'failure');
        $this->testSuiteFailures[$this->testSuiteLevel]++;
    }