from types import ModuleType

from nose.case import FunctionTestCase
from nose.plugins import Plugin


def uniform_description(test):
    if type(test).__name__ == "DocTestCase":
        return test._dt_test.name
    if isinstance(test, ModuleType):
        return test.__name__
    if isinstance(test, type):
        return "%s:%s" % (test.__module__, test.__name__)
    if isinstance(test, FunctionTestCase):
        return str(test)
    name = "%s:%s.%s" % (
        test.__module__,
        type(test).__name__,
        test._testMethodName
    )
    return name
    #return sys.modules[test.__module__].__file__


class UniformTestResultPlugin(Plugin):
    """Format test descriptions for easy comparison
    """

    name = "uniform-results"
    enabled = True

    def configure(self, options, conf):
        """Do not call super (always enabled)"""

    def describeTest(self, test):
        return uniform_description(test.test)

from types import ModuleType

from nose.case import FunctionTestCase
from nose.plugins import Plugin


def uniform_description(test):
    if type(test).__name__ == "DocTestCase":
        return test._dt_test.name
    if isinstance(test, ModuleType):
        return test.__name__
    if isinstance(test, type):
        return "%s:%s" % (test.__module__, test.__name__)
    if isinstance(test, FunctionTestCase):
        descriptor = test.descriptor or test.test
        return "%s:%s args %s" % (
            descriptor.__module__,
            descriptor.__name__,
            test.arg,
        )
    name = "%s:%s.%s" % (
        test.__module__,
        type(test).__name__,
        test._testMethodName
    )
    return name
    #return sys.modules[test.__module__].__file__


class UniformTestResultPlugin(Plugin):
    """Format test descriptions for easy comparison
    """

    name = "uniform-results"
    enabled = True

    def configure(self, options, conf):
        """Do not call super (always enabled)"""

    def describeTest(self, test):
        return uniform_description(test.test)

Use a copypastable format for function tests
Use a copypastable format for function tests

  from types import ModuleType
  
  from nose.case import FunctionTestCase
  from nose.plugins import Plugin
  
  
  def uniform_description(test):
      if type(test).__name__ == "DocTestCase":
          return test._dt_test.name
      if isinstance(test, ModuleType):
          return test.__name__
      if isinstance(test, type):
          return "%s:%s" % (test.__module__, test.__name__)
      if isinstance(test, FunctionTestCase):
-         return str(test)
+         descriptor = test.descriptor or test.test
+         return "%s:%s args %s" % (
+             descriptor.__module__,
+             descriptor.__name__,
+             test.arg,
+         )
      name = "%s:%s.%s" % (
          test.__module__,
          type(test).__name__,
          test._testMethodName
      )
      return name
      #return sys.modules[test.__module__].__file__
  
  
  class UniformTestResultPlugin(Plugin):
      """Format test descriptions for easy comparison
      """
  
      name = "uniform-results"
      enabled = True
  
      def configure(self, options, conf):
          """Do not call super (always enabled)"""
  
      def describeTest(self, test):
          return uniform_description(test.test)
  
Use a copypastable format for function tests
## Code Before:
from types import ModuleType

from nose.case import FunctionTestCase
from nose.plugins import Plugin


def uniform_description(test):
    if type(test).__name__ == "DocTestCase":
        return test._dt_test.name
    if isinstance(test, ModuleType):
        return test.__name__
    if isinstance(test, type):
        return "%s:%s" % (test.__module__, test.__name__)
    if isinstance(test, FunctionTestCase):
        return str(test)
    name = "%s:%s.%s" % (
        test.__module__,
        type(test).__name__,
        test._testMethodName
    )
    return name
    #return sys.modules[test.__module__].__file__


class UniformTestResultPlugin(Plugin):
    """Format test descriptions for easy comparison
    """

    name = "uniform-results"
    enabled = True

    def configure(self, options, conf):
        """Do not call super (always enabled)"""

    def describeTest(self, test):
        return uniform_description(test.test)

## Instruction:
Use a copypastable format for function tests
## Code After:
from types import ModuleType

from nose.case import FunctionTestCase
from nose.plugins import Plugin


def uniform_description(test):
    if type(test).__name__ == "DocTestCase":
        return test._dt_test.name
    if isinstance(test, ModuleType):
        return test.__name__
    if isinstance(test, type):
        return "%s:%s" % (test.__module__, test.__name__)
    if isinstance(test, FunctionTestCase):
        descriptor = test.descriptor or test.test
        return "%s:%s args %s" % (
            descriptor.__module__,
            descriptor.__name__,
            test.arg,
        )
    name = "%s:%s.%s" % (
        test.__module__,
        type(test).__name__,
        test._testMethodName
    )
    return name
    #return sys.modules[test.__module__].__file__


class UniformTestResultPlugin(Plugin):
    """Format test descriptions for easy comparison
    """

    name = "uniform-results"
    enabled = True

    def configure(self, options, conf):
        """Do not call super (always enabled)"""

    def describeTest(self, test):
        return uniform_description(test.test)
