Commit d16b9ff9 authored by Jérome Perrin's avatar Jérome Perrin

ERP5TypeTestSuite: let testsuite decide the log directory

Using the test class name was causing conflicts on some test classes.
CodingStyleTest was a case, all test use CodingStyleTest class with an
environment variable to control which business template is tested. In
this case, we want one log directory for each business template.

Introduce a getLogDirectoryPath method that's supposed to create and
return the path of the directory to use for log and override this method
for the special case of coding style test.
parent b8cfa2e9
...@@ -18,15 +18,18 @@ class ERP5TypeTestSuite(TestSuite): ...@@ -18,15 +18,18 @@ class ERP5TypeTestSuite(TestSuite):
def run(self, test): def run(self, test):
return self.runUnitTest(test) return self.runUnitTest(test)
def getLogDirectoryPath(self, *args, **kw):
log_directory = os.path.join(self.log_directory, args[-1].replace(':', '_'))
os.mkdir(log_directory)
return log_directory
def runUnitTest(self, *args, **kw): def runUnitTest(self, *args, **kw):
instance_home = self.instance and 'unit_test.%u' % self.instance \ instance_home = self.instance and 'unit_test.%u' % self.instance \
or 'unit_test' or 'unit_test'
if self.instance: if self.instance:
args = ('--instance_home', instance_home,) + args args = ('--instance_home', instance_home,) + args
if self.log_directory: if self.log_directory:
log_directory = os.path.join(self.log_directory, args[-1].replace(':', '_')) args = ('--log_directory', self.getLogDirectoryPath(*args, **kw), ) + args
os.mkdir(log_directory)
args = ('--log_directory', log_directory, ) + args
if self.__dict__.has_key("bt5_path"): if self.__dict__.has_key("bt5_path"):
args = ("--bt5_path=%s" % self.bt5_path,) + args args = ("--bt5_path=%s" % self.bt5_path,) + args
......
...@@ -227,6 +227,14 @@ class ERP5BusinessTemplateCodingStyleTestSuite(_ERP5): ...@@ -227,6 +227,14 @@ class ERP5BusinessTemplateCodingStyleTestSuite(_ERP5):
def run(self, full_test): def run(self, full_test):
return self.runUnitTest('CodingStyleTest', TESTED_BUSINESS_TEMPLATE=full_test) return self.runUnitTest('CodingStyleTest', TESTED_BUSINESS_TEMPLATE=full_test)
def getLogDirectoryPath(self, *args, **kw):
log_directory = os.path.join(
self.log_directory,
'{}-{}'.format(args[-1] , kw['TESTED_BUSINESS_TEMPLATE']))
os.mkdir(log_directory)
return log_directory
class RJS_Only(_ERP5): class RJS_Only(_ERP5):
def getTestList(self): def getTestList(self):
rjs_officejs_bt_list = ["erp5_officejs_", rjs_officejs_bt_list = ["erp5_officejs_",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment