~testtools-dev/testtools/trunk

« back to all changes in this revision

Viewing changes to testtools/tests/helpers.py

  • Committer: Jonathan Lange
  • Date: 2011-07-31 13:42:26 UTC
  • mfrom: (219.2.2 clarify-fixtures-dep)
  • Revision ID: jml@canonical.com-20110731134226-s0vi8z9zklpo37oz
Don't depend on fixtures to run the tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
import sys
10
10
 
11
 
from fixtures import FunctionFixture
12
 
 
13
11
from testtools import TestResult
14
12
from testtools.helpers import (
15
13
    safe_hasattr,
98
96
    return result
99
97
 
100
98
 
101
 
StackHidingFixture = lambda x: FunctionFixture(
102
 
    lambda: hide_testtools_stack(x), hide_testtools_stack)
 
99
def run_with_stack_hidden(should_hide, f, *args, **kwargs):
 
100
    old_should_hide = hide_testtools_stack(should_hide)
 
101
    try:
 
102
        return f(*args, **kwargs)
 
103
    finally:
 
104
        hide_testtools_stack(old_should_hide)