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):
|
47 | 47 | self.descriptions = descriptions |
48 | 48 | |
49 | 49 | 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 | |
50 | 55 | doc_first_line = test.shortDescription() |
51 | 56 | if self.descriptions and doc_first_line: |
52 | | return '\n'.join((str(test), doc_first_line)) |
| 57 | return '\n'.join((path, doc_first_line)) |
53 | 58 | else: |
54 | | return str(test) |
| 59 | return path |
55 | 60 | |
56 | 61 | def startTest(self, test): |
57 | 62 | super(TextTestResult, self).startTest(test) |