Do some setup after initialisation.

        :param test: The test that passes or fails the assertion.
        :type test: NodeNG or None

        :param fail: The message shown when the assertion fails.
        :type fail: NodeNG or None
420691
def postinit(self, test=None, fail=None):
        
        self.fail = fail
        self.test = test
201508
def addExpectedFailure(self, test, err):
        
        super().addExpectedFailure(test, err)
        self.test_info(test)
        self._call_test_results('addExpectedFailure', test, err)
539606
def dependency_failed(test, results):
        """"""
        for d in (NoseDepUtils.test_name(i) for i in dependencies[test]):
            if results.get(d) and results.get(d) != 'passed':
                return "Required test '{}' {}".format(d, results.get(d).upper())
        return None
320591
def run(self, test):
        ""
        # These parts of Nose's pluggability are baked into
        # nose.core.TextTestRunner. Reproduce them:
        wrapper = self.config.plugins.prepareTest(test)
        if wrapper is not None:
            test = wrapper
        wrapped = self.config.plugins.setOutputStream(self.stream)
        if wrapped is not None:
            self.stream = wrapped

        result = self._makeResult()
        startTime = time()
        try:
            test(result)
        except KeyboardInterrupt:
            # we need to ignore these exception to not
            # show traceback when user intentionally
            # interrupted test suite execution, and
            # to output some reasonable results on
            # already passed and failed tests.
            pass
        stopTime = time()

        # We don't care to hear about errors again at the end; we take care of
        # that in result.addError(), while the tests run.
        # result.printErrors()
        #
        # However, we do need to call this one useful line from
        # nose.result.TextTestResult's implementation of printErrors() to make
        # sure other plugins get a chance to report:
        self.config.plugins.report(self.stream)

        result.printSummary(startTime, stopTime)
        self.config.plugins.finalize(result)
        return result
497933
def fail(message = nil)
      if @__assert_pending__ == 0
        if halt_on_fail?
          raise Result::TestFailure, message || ""
        else
          capture_result(Assert::Result::Fail, message || "")
        end
      else
        if halt_on_fail?
          raise Result::TestSkipped, "Pending fail: #{message || ""}"
        else
          capture_result(Assert::Result::Skip, "Pending fail: #{message || ""}")
        end
      end
    end
618383
def report
      return if failures.nil? # because danger calls `report` before loading a file
      warn("Skipped #{skipped.count} tests.") if show_skipped_tests && skipped.count > 0

      unless failures.empty? && errors.empty?
        fail('Tests have failed, see below for more information.', sticky: false)
        message = "### Tests: \n\n"

        tests = (failures + errors)

        common_attributes = tests.map{|test| test.attributes.keys }.inject(&:&)

        # check the provided headers are available
        unless headers.nil?
          not_available_headers = headers.select { |header| not common_attributes.include?(header) }
          raise "Some of headers provided aren't available in the JUnit report (#{not_available_headers})" unless not_available_headers.empty?
        end

        keys = headers || common_attributes
        attributes = keys.map(&:to_s).map(&:capitalize)

        # Create the headers
        message << attributes.join(' | ') + "|\n"
        message << attributes.map { |_| '---' }.join(' | ') + "|\n"

        # Map out the keys to the tests
        tests.each do |test|
          row_values = keys.map { |key| test.attributes[key] }.map { |v| auto_link(v) }
          message << row_values.join(' | ') + "|\n"
        end

        markdown message
      end
    end
212818
def _raise_fail(self, response, expected):
        
        try:
            if self.logger:
                self.logger.error("Status code "
                                  "{} != {}. \n\n "
                                  "Payload: {}".format(response.status_code,
                                                       expected,
                                                       response.content))
            raise TestStepFail("Status code {} != {}.".format(response.status_code, expected))
        except TestStepFail:
            raise
        except:  # pylint: disable=bare-except
            if self.logger:
                self.logger.error("Status code "
                                  "{} != {}. \n\n "
                                  "Payload: {}".format(response.status_code,
                                                       expected,
                                                       "Unable to parse payload"))
            raise TestStepFail("Status code {} != {}.".format(response.status_code, expected))
896010
def failed(self, reason=None):
        '''
        
        '''
        self.set_status(Report.FAILED)
        if reason:
            self.add('reason', reason)
406269
def fail(self, exception):
        
        fail = failure.create(exception, self._queue, self._payload,
                              self._worker)
        fail.save(self.resq)
        return fail
648356
def __assert_empty(returned):
        '''
        
        '''
        result = "Pass"
        try:
            assert (not returned), "{0} is not empty".format(returned)
        except AssertionError as err:
            result = "Fail: " + six.text_type(err)
        return result
233110
def assert test, msg = nil
      msg ||= "Failed assertion, no message given."
      # comment out self.assertions += 1 to counting assertions
      unless test then
        msg = msg.call if Proc === msg
        raise RWebSpec::Assertion, msg
      end
      true
    end
1053749
def compare(self, node, prev_value=None, prev_index=None):
        
        if prev_value is not None and node.value != prev_value or \
           prev_index is not None and node.index != prev_index:
            raise TestFailed(index=self.index)
389405
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
    {
        $this->doAddFault($test, $e, $time, 'failure');
        $this->testSuiteFailures[$this->testSuiteLevel]++;
    }
805524
def trial(path=TESTS_PATH, coverage=False):
    
    args = ['trial']
    if coverage:
        args.append('--coverage')
    args.append(path)
    print args
    local(' '.join(args))
471154
def _failed(self, msg):
        
        self.log(msg)
        self.result.passed = False
        self.result.add_error(msg)
        self.log(u"Failed")
115137
public static void assertTrue(String message, boolean value) {
        if (value) {
            pass(message);
        } else {
            fail(message, null);
        }
    }
895883
def spin_assert(self, assertion, failure_message='Failed Assertion', timeout=None):
        
        timeout = self.timeout if timeout is None else timeout
        time_spent = 0
        while time_spent < timeout:
            try:
                assert assertion() is True
                return True
            except AssertionError:
                pass
            sleep(self.step)
            time_spent += 1
        raise WebDriverAssertionException.WebDriverAssertionException(self.driver_wrapper, failure_message)