26 import logging |
26 import logging |
27 import shutil |
27 import shutil |
28 import pickle |
28 import pickle |
29 import glob |
29 import glob |
30 import warnings |
30 import warnings |
|
31 import hashlib |
31 from datetime import timedelta |
32 from datetime import timedelta |
32 from os.path import (abspath, join, exists, basename, dirname, normpath, split, |
33 from os.path import (abspath, join, exists, basename, dirname, normpath, split, |
33 isfile, isabs, splitext, isdir, expanduser) |
34 isfile, isabs, splitext, isdir, expanduser) |
34 from functools import partial |
35 from functools import partial |
35 import hashlib |
|
36 |
36 |
37 from logilab.common.date import strptime |
37 from logilab.common.date import strptime |
38 from logilab.common.decorators import cached, clear_cache |
38 from logilab.common.decorators import cached, clear_cache |
39 from cubicweb import CW_SOFTWARE_ROOT, ConfigurationError, schema, cwconfig, BadConnectionId |
39 |
|
40 from cubicweb import ConfigurationError, ExecutionError, BadConnectionId |
|
41 from cubicweb import CW_SOFTWARE_ROOT, schema, cwconfig |
40 from cubicweb.server.serverconfig import ServerConfiguration |
42 from cubicweb.server.serverconfig import ServerConfiguration |
41 from cubicweb.etwist.twconfig import TwistedConfiguration |
43 from cubicweb.etwist.twconfig import TwistedConfiguration |
42 |
44 |
43 cwconfig.CubicWebConfiguration.cls_adjust_sys_path() |
45 cwconfig.CubicWebConfiguration.cls_adjust_sys_path() |
44 |
46 |
195 """By default, we run tests with the sqlite DB backend. One may use its |
197 """By default, we run tests with the sqlite DB backend. One may use its |
196 own configuration by just creating a 'sources' file in the test |
198 own configuration by just creating a 'sources' file in the test |
197 directory from wich tests are launched or by specifying an alternative |
199 directory from wich tests are launched or by specifying an alternative |
198 sources file using self.sourcefile. |
200 sources file using self.sourcefile. |
199 """ |
201 """ |
200 sources = super(TestServerConfiguration, self).sources() |
202 try: |
|
203 sources = super(TestServerConfiguration, self).sources() |
|
204 except ExecutionError: |
|
205 sources = {} |
201 if not sources: |
206 if not sources: |
202 sources = DEFAULT_SOURCES |
207 sources = DEFAULT_SOURCES |
203 if 'admin' not in sources: |
208 if 'admin' not in sources: |
204 sources['admin'] = DEFAULT_SOURCES['admin'] |
209 sources['admin'] = DEFAULT_SOURCES['admin'] |
205 return sources |
210 return sources |