コード例 #1
0
    def _getSuite(self, test):
        if hasattr(test, "suite"):
            suite = strclass(test.suite)
            suite_location = test.suite.location
            location = test.suite.abs_location
            if hasattr(test, "lineno"):
                location = location + ":" + str(test.lineno)
            else:
                location = location + ":" + str(test.test.lineno)
        else:
            suite = strclass(test.__class__)
            suite_location = "python_nosetestid://" + suite
            try:
                from nose.util import func_lineno

                if hasattr(test.test, "descriptor") and test.test.descriptor:
                    suite_location = "file://" + self.test_address(
                        test.test.descriptor)
                    location = suite_location + ":" + str(
                        func_lineno(test.test.descriptor))
                else:
                    suite_location = "file://" + self.test_address(
                        test.test.test)
                    location = "file://" + self.test_address(
                        test.test.test) + ":" + str(func_lineno(
                            test.test.test))
            except:
                test_id = test.id()
                suite_id = test_id[:test_id.rfind(".")]
                suite_location = "python_nosetestid://" + str(suite_id)
                location = "python_nosetestid://" + str(test_id)
        return (location, suite_location)
コード例 #2
0
  def _getSuite(self, test):
    if hasattr(test, "suite"):
      suite = strclass(test.suite)
      suite_location = test.suite.location
      location = test.suite.abs_location
      if hasattr(test, "lineno"):
        location = location + ":" + str(test.lineno)
      else:
        location = location + ":" + str(test.test.lineno)
    else:
      suite = strclass(test.__class__)
      suite_location = "python_nosetestid://" + suite
      try:
        from nose.util import func_lineno

        if hasattr(test.test, "descriptor") and test.test.descriptor:
          suite_location = "file://" + self.test_address(
            test.test.descriptor)
          location = suite_location + ":" + str(
            func_lineno(test.test.descriptor))
        else:
          suite_location = "file://" + self.test_address(
            test.test.test)
          location = "file://" + self.test_address(
            test.test.test) + ":" + str(func_lineno(test.test.test))
      except:
        test_id = test.id()
        suite_id = test_id[:test_id.rfind(".")]
        suite_location = "python_nosetestid://" + str(suite_id)
        location = "python_nosetestid://" + str(test_id)
    return (location, suite_location)