[Erp5-report] r13873 - /erp5/trunk/products/ERP5OOo/tests/testIngestion.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Apr 3 09:51:53 CEST 2007


Author: jerome
Date: Tue Apr  3 09:51:52 2007
New Revision: 13873

URL: http://svn.erp5.org?rev=13873&view=rev
Log:
unpack the content of testIngestion_docs.zip at runtime


Modified:
    erp5/trunk/products/ERP5OOo/tests/testIngestion.py

Modified: erp5/trunk/products/ERP5OOo/tests/testIngestion.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/testIngestion.py?rev=13873&r1=13872&r2=13873&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testIngestion.py (original)
+++ erp5/trunk/products/ERP5OOo/tests/testIngestion.py Tue Apr  3 09:51:52 2007
@@ -85,7 +85,7 @@
     self.headers = {}
 
 def makeFilePath(name):
-  return os.getenv('INSTANCE_HOME') + '/../Products/ERP5OOo/tests/' + name
+  return os.getenv('INSTANCE_HOME') + '/../Products/ERP5OOo/tests/data/' + name
 
 def makeFileUpload(name):
   path = makeFilePath(name)
@@ -128,6 +128,26 @@
     self.createCategories()
     self.createPreferences()
     self.createTools()
+    self.unpackData()
+  
+  def unpackData(self):
+    """
+      Unpack the content of testIngestion_docs.zip
+    """
+    join = os.path.join
+    base_path = join(os.getenv('INSTANCE_HOME'), '..', 'Products', 'ERP5OOo', 'tests')
+    zf = zipfile.ZipFile(join(base_path, 'testIngestion_docs.zip'))
+    data_dir = join(base_path, 'data')
+    if not os.path.isdir(data_dir):
+      os.mkdir(data_dir)
+    for name in zf.namelist():
+      fname = join(data_dir, name)
+      if not os.path.exists(fname):
+        try:
+          f = open(fname, 'w')
+          f.write(zf.read(name))
+        finally:
+          f.close()
 
   def createTools(self):
     """




More information about the Erp5-report mailing list