# HG changeset patch # User Sylvain Thénault # Date 1463735386 -7200 # Node ID ce04184fbf904f9ac92c36589dbdf8612cfef32f # Parent 1a3a0ac2b41ddc705d7c7af25859c34fa33d9241 [devtools] deprecate usage of sources file for test This is old support which clutters the code and should no more be used. As this is rarely used (if it is) and test only, it feels ok to drop support at once without a deprecation phase. diff -r 1a3a0ac2b41d -r ce04184fbf90 cubicweb/devtools/__init__.py --- a/cubicweb/devtools/__init__.py Fri May 20 13:07:21 2016 +0200 +++ b/cubicweb/devtools/__init__.py Fri May 20 11:09:46 2016 +0200 @@ -189,33 +189,24 @@ # no cubes self.init_cubes(()) - sourcefile = None - def sources_file(self): - """define in subclasses self.sourcefile if necessary""" - if self.sourcefile: - print('Reading sources from', self.sourcefile) - sourcefile = self.sourcefile - if not isabs(sourcefile): - sourcefile = join(self.apphome, sourcefile) - else: - sourcefile = super(TestServerConfiguration, self).sources_file() - return sourcefile - def read_sources_file(self): """By default, we run tests with the sqlite DB backend. One may use its own configuration by just creating a 'sources' file in the test directory from which tests are launched or by specifying an alternative sources file using self.sourcefile. """ + if getattr(self, 'sourcefile', None): + raise Exception('sourcefile isn\'t supported anymore, specify your database ' + 'configuration using proper configuration class (e.g. ' + 'PostgresApptestConfiguration)') try: - sources = super(TestServerConfiguration, self).read_sources_file() + super(TestServerConfiguration, self).read_sources_file() + raise Exception('test configuration shouldn\'t provide a sources file, specify your ' + 'database configuration using proper configuration class (e.g. ' + 'PostgresApptestConfiguration)') except ExecutionError: - sources = {} - if not sources: - sources = self.default_sources - if 'admin' not in sources: - sources['admin'] = self.default_sources['admin'] - return sources + pass + return self.default_sources # web config methods needed here for cases when we use this config as a web # config