devtools/testlib.py
changeset 6631 26c303c3f1aa
parent 6590 37b7f4df46b3
child 6687 0b1f5c14646e
equal deleted inserted replaced
6630:f516ee1ef36c 6631:26c303c3f1aa
    23 
    23 
    24 import os
    24 import os
    25 import sys
    25 import sys
    26 import re
    26 import re
    27 import urlparse
    27 import urlparse
    28 from os.path import dirname, join
    28 from os.path import dirname, join, abspath
    29 from urllib import unquote
    29 from urllib import unquote
    30 from math import log
    30 from math import log
    31 from contextlib import contextmanager
    31 from contextlib import contextmanager
    32 from warnings import warn
    32 from warnings import warn
    33 
    33 
   197         Configuration is cached on the test class.
   197         Configuration is cached on the test class.
   198         """
   198         """
   199         try:
   199         try:
   200             return cls.__dict__['_config']
   200             return cls.__dict__['_config']
   201         except KeyError:
   201         except KeyError:
   202             home = join(dirname(sys.modules[cls.__module__].__file__), cls.appid)
   202             home = abspath(join(dirname(sys.modules[cls.__module__].__file__), cls.appid))
   203             config = cls._config = cls.configcls(cls.appid, apphome=home)
   203             config = cls._config = cls.configcls(cls.appid, apphome=home)
   204             config.mode = 'test'
   204             config.mode = 'test'
   205             return config
   205             return config
   206 
   206 
   207     @classmethod
   207     @classmethod