Changeset 7581 for main/waeup.sirp/trunk/src
- Timestamp:
- 3 Feb 2012, 14:53:04 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/testing.py
r7321 r7581 23 23 import os.path 24 24 import re 25 import tempfile 26 import shutil 25 27 import unittest 26 28 import warnings … … 29 31 from zope.app.testing.functional import ( 30 32 ZCMLLayer, FunctionalTestSetup, getRootFolder, sync, FunctionalTestCase) 31 from zope.component import getGlobalSiteManager 33 from zope.component import getGlobalSiteManager, queryUtility 32 34 from zope.security.testing import addCheckerPublic 33 35 from zope.testing import renormalizing … … 186 188 return True 187 189 190 def setup_datacenter_conf(): 191 """Register a datacenter config utility for non-functional tests. 192 """ 193 from waeup.sirp.interfaces import IDataCenterConfig 194 conf = queryUtility(IDataCenterConfig) 195 if conf is not None: 196 return 197 path = tempfile.mkdtemp() 198 conf = {'path': path} 199 gsm = getGlobalSiteManager() 200 gsm.registerUtility(conf, IDataCenterConfig) 201 return 202 203 def teardown_datacenter_conf(): 204 """Unregister a datacenter config utility for non-functional tests. 205 """ 206 from waeup.sirp.interfaces import IDataCenterConfig 207 conf = queryUtility(IDataCenterConfig) 208 if conf is None: 209 return 210 path = conf['path'] 211 shutil.rmtree(path) 212 gsm = getGlobalSiteManager() 213 gsm.unregisterUtility(conf) 214 return 188 215 189 216 class SIRPUnitTestLayer(object): … … 226 253 #setUpZope(None) 227 254 grokked = maybe_grok() 228 if grokked: 229 pass 230 #setUpZope(None) 255 setup_datacenter_conf() 231 256 return 232 257 … … 234 259 def tearDown(cls): 235 260 cleanUpZope(None) 261 teardown_datacenter_conf() 262 return 263 236 264 237 265 #: This extended :class:`doctest.OutputChecker` allows the following
Note: See TracChangeset for help on using the changeset viewer.