Update of /cvsroot/monetdb/sql/src/test/Dependencies/Tests
In directory 
23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20774/src/test/Dependencies/Tests

Modified Files:
      Tag: Nov2009
        Dependencies.SQL.py 
Log Message:
New module MonetDBtesting.process to make it easier to write tests in Python.

U Dependencies.SQL.py
Index: Dependencies.SQL.py
===================================================================
RCS file: /cvsroot/monetdb/sql/src/test/Dependencies/Tests/Dependencies.SQL.py,v
retrieving revision 1.6.8.1
retrieving revision 1.6.8.2
diff -u -d -r1.6.8.1 -r1.6.8.2
--- Dependencies.SQL.py 12 Oct 2009 15:36:21 -0000      1.6.8.1
+++ Dependencies.SQL.py 15 Oct 2009 15:50:54 -0000      1.6.8.2
@@ -1,40 +1,32 @@
 import os, sys
-import subprocess
-
-def client(cmd):
-    clt = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, 
stderr=subprocess.PIPE)
-    sys.stdout.write(clt.stdout.read())
-    clt.stdout.close()
-    sys.stderr.write(clt.stderr.read())
-    clt.stderr.close()
-
+from MonetDBtesting import process
 
+def client(cmd, infile, user = None, passwd = None):
+    clt = process.client(cmd, user = user, passwd = passwd,
+                         stdin = open(infile), stdout = process.PIPE,
+                         stderr = process.PIPE)
+    out, err = clt.communicate()
+    sys.stdout.write(out)
+    sys.stderr.write(err)
 
 def main():
-    clcmd = str(os.getenv('SQL_CLIENT'))
-    clcmd1 = str(os.getenv('SQL_CLIENT')) + " -umonet_test -Ppass_test"
-
     sys.stdout.write('Dependencies between User and Schema\n')
-    sys.stdout.flush()
-    client(clcmd + "<%s" % ('%s/../dependency_owner_schema_1.sql' % 
os.getenv('RELSRCDIR')))
+    client('sql', os.path.join(os.getenv('RELSRCDIR'), '..', 
'dependency_owner_schema_1.sql'))
     sys.stdout.write('done\n')
 
-    client(clcmd1 + "<%s" % ('%s/../dependency_owner_schema_2.sql' % 
os.getenv('RELSRCDIR')))
+    client('sql', os.path.join(os.getenv('RELSRCDIR'), '..', 
'dependency_owner_schema_2.sql'), user = 'monet_test', passwd = 'pass_test')
     sys.stdout.write('done\n')
 
     sys.stdout.write('Dependencies between database objects\n')
-    sys.stdout.flush()
-    client(clcmd + "<%s" % ('%s/../dependency_DBobjects.sql' % 
os.getenv('RELSRCDIR')))
+    client('sql', os.path.join(os.getenv('RELSRCDIR'), '..', 
'dependency_DBobjects.sql'))
     sys.stdout.write('done\n')
 
     sys.stdout.write('Dependencies between functions with same name\n')
-    sys.stdout.flush()
-    client(clcmd + "<%s" % ('%s/../dependency_functions.sql' % 
os.getenv('RELSRCDIR')))
+    client('sql', os.path.join(os.getenv('RELSRCDIR'), '..', 
'dependency_functions.sql'))
     sys.stdout.write('done\n')
 
     sys.stdout.write('Cleanup\n')
-    sys.stdout.flush()
-    client(clcmd + "<%s" % ('%s/../dependency_owner_schema_3.sql' % 
os.getenv('RELSRCDIR')))
+    client('sql', os.path.join(os.getenv('RELSRCDIR'), '..', 
'dependency_owner_schema_3.sql'))
     sys.stdout.write('done\n')
 
 main()


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to