[glom] LDTP: Added missing XML data files



commit 032fea7076e2d276a49dda93c8381af5d8d060a2
Author: Armin Burgmeier <armin arbur net>
Date:   Sat Jun 27 19:17:35 2009 +0200

    LDTP: Added missing XML data files
    
    2009-06-27  Armin Burgmeier  <armin openismus com>
    
    	* ldtp/database-creation/postgres-central-empty.xml:
    	* ldtp/database-creation/postgres-self-empty.xml:
    	* ldtp/database-creation/sqlite-empty.xml: Added missing files.
    
    	* ldtp/database-creation/create-db.py: Allow passing the datafilename
    	as an argument when the script is called directly, not by ldtprunner.
    
    	* ldtp/README: Updated the section on how to execute a single test
    	script.

 ChangeLog                                         |   12 ++++++++++++
 ldtp/README                                       |    5 +++--
 ldtp/database-creation/create-db.py               |   21 +++++++++++++++++----
 ldtp/database-creation/postgres-central-empty.xml |    4 ++++
 ldtp/database-creation/postgres-self-empty.xml    |    4 ++++
 ldtp/database-creation/sqlite-empty.xml           |    4 ++++
 6 files changed, 44 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ec24b08..6fb5a67 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-06-27  Armin Burgmeier  <armin openismus com>
+
+	* ldtp/database-creation/postgres-central-empty.xml:
+	* ldtp/database-creation/postgres-self-empty.xml:
+	* ldtp/database-creation/sqlite-empty.xml: Added missing files.
+
+	* ldtp/database-creation/create-db.py: Allow passing the datafilename
+	as an argument when the script is called directly, not by ldtprunner.
+
+	* ldtp/README: Updated the section on how to execute a single test
+	script.
+
 2009-06-26  Armin Burgmeier  <armin openismus com>
 
 	* glom/libglom/document/bakery/document.h: Document that failure_code
diff --git a/ldtp/README b/ldtp/README
index d595510..93fceff 100644
--- a/ldtp/README
+++ b/ldtp/README
@@ -3,9 +3,10 @@ To run all the tests, simply execute
 	ldtprunner test.xml
 
 This produces a glom-test-log.xml log file with the test results. To run a
-single test, simply launch the corresponding python script, such as
+single test, simply launch the corresponding python script, optionally with
+the data XML file as an argument, such as
 
-	database-creation/self-hosted.py
+	database-creation/create-db.py database-creation/postgres-self-empty.xml
 
 Make sure to execute all scripts from the glom/ldtp directory, they might not
 find required files otherwise. For the tests which test central hosting,
diff --git a/ldtp/database-creation/create-db.py b/ldtp/database-creation/create-db.py
index c8a082a..0c6e0e8 100755
--- a/ldtp/database-creation/create-db.py
+++ b/ldtp/database-creation/create-db.py
@@ -2,7 +2,7 @@
 from ldtp import *
 from ldtputils import *
 
-sys.path = ['..'] + sys.path
+sys.path = ['..'] + ['.'] + sys.path
 import common
 
 import os
@@ -42,12 +42,25 @@ def delete_database(backend):
 		op.set_value_at('/SERVER_CNX_P/ADM_PASSWORD', password)
 		gda.gda_perform_drop_database('PostgreSQL', op)
 
-       	shutil.rmtree('TestDatabase')
+	try:
+	       	shutil.rmtree('TestDatabase')
+	except OSError:
+		pass
 
 try:
+	# Load data XML from command line when called directly:
+	if sys.argv[0].find('ldtprunner') == -1 and len(sys.argv) > 1:
+		datafilename = sys.argv[1]
+
 	parser = LdtpDataFileParser(datafilename)
-	backend = parser.gettagvalue('backend')[0]
-	example = int(parser.gettagvalue('example')[0])
+	backend = parser.gettagvalue('backend')
+	example = parser.gettagvalue('example')
+
+	if len(backend) == 0 or len(example) == 0:
+		raise LdtpExecutionError('<backend> or <example> tag not set in "' + datafilename + '"')
+
+	backend = backend[0]
+	example = int(example[0])
 
 	common.launch_glom()
 
diff --git a/ldtp/database-creation/postgres-central-empty.xml b/ldtp/database-creation/postgres-central-empty.xml
new file mode 100644
index 0000000..c96be2b
--- /dev/null
+++ b/ldtp/database-creation/postgres-central-empty.xml
@@ -0,0 +1,4 @@
+<data>
+	<backend>PostgresCentral</backend>
+	<example>0</example>
+</data>
diff --git a/ldtp/database-creation/postgres-self-empty.xml b/ldtp/database-creation/postgres-self-empty.xml
new file mode 100644
index 0000000..2f45527
--- /dev/null
+++ b/ldtp/database-creation/postgres-self-empty.xml
@@ -0,0 +1,4 @@
+<data>
+	<backend>PostgresSelf</backend>
+	<example>0</example>
+</data>
diff --git a/ldtp/database-creation/sqlite-empty.xml b/ldtp/database-creation/sqlite-empty.xml
new file mode 100644
index 0000000..8861cf1
--- /dev/null
+++ b/ldtp/database-creation/sqlite-empty.xml
@@ -0,0 +1,4 @@
+<data>
+	<backend>SQLite</backend>
+	<example>0</example>
+</data>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]