Commit 724a9948 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Test runner generate the global temporary directory and report import errors.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1250 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 3410bd1b
...@@ -17,8 +17,10 @@ ...@@ -17,8 +17,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import unittest import unittest
import tempfile
import logging import logging
import time import time
import os
# list of test modules # list of test modules
# each of them have to import its TestCase classes # each of them have to import its TestCase classes
...@@ -96,6 +98,9 @@ class NeoTestRunner(unittest.TestResult): ...@@ -96,6 +98,9 @@ class NeoTestRunner(unittest.TestResult):
self.modulesStats = {} self.modulesStats = {}
self.failedImports = {} self.failedImports = {}
self.lastStart = None self.lastStart = None
self.temp_directory = tempfile.mkdtemp(prefix='neo_')
os.environ['TEMP'] = self.temp_directory
print "Base directory : %s" % (self.temp_directory, )
def run(self, name, modules): def run(self, name, modules):
suite = unittest.TestSuite() suite = unittest.TestSuite()
...@@ -172,6 +177,7 @@ class NeoTestRunner(unittest.TestResult): ...@@ -172,6 +177,7 @@ class NeoTestRunner(unittest.TestResult):
Node : %s Node : %s
Processor : %s (%s) Processor : %s (%s)
System : %s (%s) System : %s (%s)
Directory : %s
""" % ( """ % (
datetime.date.today().isoformat(), datetime.date.today().isoformat(),
platform.node(), platform.node(),
...@@ -179,6 +185,7 @@ class NeoTestRunner(unittest.TestResult): ...@@ -179,6 +185,7 @@ class NeoTestRunner(unittest.TestResult):
platform.architecture()[0], platform.architecture()[0],
platform.system(), platform.system(),
platform.release(), platform.release(),
self.temp_directory,
) )
return s return s
...@@ -277,7 +284,7 @@ class NeoTestRunner(unittest.TestResult): ...@@ -277,7 +284,7 @@ class NeoTestRunner(unittest.TestResult):
msg['X-ERP5-Tests-Status'] = 'OK' msg['X-ERP5-Tests-Status'] = 'OK'
# write the body # write the body
body = MIMEText(self.summary + self.errors, 'text') body = MIMEText(self.summary + self.warnings + self.errors, 'text')
msg.attach(body) msg.attach(body)
# attach the log file # attach the log file
......
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