devtools/testlib.py
branchstable
changeset 6585 9af22f2c0c4c
parent 6469 82cf41ae8b89
child 6586 207dc5111af2
child 6587 0bf81efd55f9
equal deleted inserted replaced
6572:df0b2de62cec 6585:9af22f2c0c4c
    22 __docformat__ = "restructuredtext en"
    22 __docformat__ = "restructuredtext en"
    23 
    23 
    24 import os
    24 import os
    25 import sys
    25 import sys
    26 import re
    26 import re
       
    27 import urlparse
       
    28 from os.path import dirname
    27 from urllib import unquote
    29 from urllib import unquote
    28 import urlparse
       
    29 from math import log
    30 from math import log
    30 from contextlib import contextmanager
    31 from contextlib import contextmanager
    31 from warnings import warn
    32 from warnings import warn
    32 
    33 
    33 import yams.schema
    34 import yams.schema
   196         Configuration is cached on the test class.
   197         Configuration is cached on the test class.
   197         """
   198         """
   198         try:
   199         try:
   199             return cls.__dict__['_config']
   200             return cls.__dict__['_config']
   200         except KeyError:
   201         except KeyError:
   201             config = cls._config = cls.configcls(cls.appid)
   202             home = join(dirname(sys.modules[self.__class__.__module__].__file__),
       
   203                         cls.appid)
       
   204             config = cls._config = cls.configcls(cls.appid, apphome=home)
   202             config.mode = 'test'
   205             config.mode = 'test'
   203             return config
   206             return config
   204 
   207 
   205     @classmethod
   208     @classmethod
   206     def init_config(cls, config):
   209     def init_config(cls, config):