Ignore:
Timestamp:
11 Feb 2015, 15:28:49 (10 years ago)
Author:
uli
Message:

Move test helper.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_async.py

    r12581 r12595  
    33import tempfile
    44import transaction
    5 from contextlib import contextmanager
    65from zc.async.testing import wait_for_result
    76from zope.component import getUtility
     
    1211from waeup.kofa.async import AsyncJob, get_job_id
    1312from waeup.kofa.interfaces import IJobManager, IKofaUtils
    14 from waeup.kofa.testing import FunctionalTestCase, FunctionalLayer
     13from waeup.kofa.testing import (
     14    FunctionalTestCase, FunctionalLayer, expensive_actions,
     15    )
    1516from waeup.kofa.tests.test_async import FunctionalAsyncTestCase
    1617
     
    2223def dummy_func():
    2324    return 42
    24 
    25 
    26 @contextmanager
    27 def expensive_actions():
    28     """A contextmanager to work with a modified `expensive_acrtions_allowed()`
    29 
    30     This method is part of local IKofaUtils.
    31     """
    32     utils = getUtility(IKofaUtils)
    33     old_func = utils.expensive_actions_allowed
    34     try:
    35         yield utils
    36     finally:
    37         # restore function after use
    38         utils.expensive_actions_allowed = old_func
    3925
    4026
Note: See TracChangeset for help on using the changeset viewer.