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

« back to all changes in this revision

Viewing changes to lib/testresources/__init__.py

  • 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:
374
374
        stack = inspect.stack()
375
375
        for frame in stack[3:]:
376
376
            if frame[3] in ('run', '__call__'):
377
 
                return frame[0].f_locals['result']
 
377
                # Not all frames called 'run' will be unittest. It could be a
 
378
                # reactor in trial, for instance.
 
379
                result = frame[0].f_locals.get('result')
 
380
                if (result is not None and
 
381
                    getattr(result, 'startTest', None) is not None):
 
382
                    return result
378
383
 
379
384
    def setUp(self):
380
385
        unittest.TestCase.setUp(self)