Ticket #14603: 0001-Change-description-for-failed-tests-to-a-copy-paste-.patch

File 0001-Change-description-for-failed-tests-to-a-copy-paste-.patch, 1.2 KB (added by teh, 14 years ago)
  • packages/django/utils/unittest/runner.py

    From 45defca1b56bd5ad1ee46dff5a290fb7afc7b47a Mon Sep 17 00:00:00 2001
    From: Thomas Hunger <teh@playfire.com>
    Date: Tue, 2 Nov 2010 15:00:35 +0000
    Subject: [PATCH] Change description for failed tests to a copy & paste-able format.
    
    ---
     packages/django/utils/unittest/runner.py |    9 +++++++--
     1 files changed, 7 insertions(+), 2 deletions(-)
    
    diff --git a/packages/django/utils/unittest/runner.py b/packages/django/utils/unittest/runner.py
    index 242173e..11d4c60 100644
    a b class TextTestResult(result.TestResult):  
    4747        self.descriptions = descriptions
    4848
    4949    def getDescription(self, test):
     50        app = test.__module__.split('.')[-2]
     51        klass = test.__class__.__name__
     52        method = test._testMethodName
     53        path = '%s.%s.%s' % (app, klass, method)
     54
    5055        doc_first_line = test.shortDescription()
    5156        if self.descriptions and doc_first_line:
    52             return '\n'.join((str(test), doc_first_line))
     57            return '\n'.join((path, doc_first_line))
    5358        else:
    54             return str(test)
     59            return path
    5560
    5661    def startTest(self, test):
    5762        super(TextTestResult, self).startTest(test)
Back to Top