~ubuntu-branches/ubuntu/maverick/testresources/maverick

« back to all changes in this revision

Viewing changes to debian/patches/crash-in-teardown.patch

  • Committer: Bazaar Package Importer
  • Author(s): Robert Collins
  • Date: 2009-09-20 17:19:22 UTC
  • Revision ID: james.westby@ubuntu.com-20090920171922-m8qipt2z5b49p8zi
Tags: 0.2-1
* Incorporate Ubuntu uploads and Debian NMU's.
* Convert CDBS patch to merge from trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
diff -Nur -x '*.orig' -x '*~' testresources-0.2/lib/testresources/__init__.py testresources-0.2.new/lib/testresources/__init__.py
2
 
--- testresources-0.2/lib/testresources/__init__.py     2009-07-17 13:20:26.000000000 +0100
3
 
+++ testresources-0.2.new/lib/testresources/__init__.py 2009-08-05 23:38:21.000000000 +0100
4
 
@@ -374,7 +374,12 @@
5
 
         stack = inspect.stack()
6
 
         for frame in stack[3:]:
7
 
             if frame[3] in ('run', '__call__'):
8
 
-                return frame[0].f_locals['result']
9
 
+                # Not all frames called 'run' will be unittest. It could be a
10
 
+                # reactor in trial, for instance.
11
 
+                result = frame[0].f_locals.get('result')
12
 
+                if (result is not None and
13
 
+                    getattr(result, 'startTest', None) is not None):
14
 
+                    return result
15
 
 
16
 
     def setUp(self):
17
 
         unittest.TestCase.setUp(self)