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

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

U create.SQL.py
Index: create.SQL.py
===================================================================
RCS file: /cvsroot/monetdb/sql/src/test/UserDump/Tests/create.SQL.py,v
retrieving revision 1.3.4.1
retrieving revision 1.3.4.2
diff -u -d -r1.3.4.1 -r1.3.4.2
--- create.SQL.py       12 Oct 2009 15:36:23 -0000      1.3.4.1
+++ create.SQL.py       15 Oct 2009 15:50:55 -0000      1.3.4.2
@@ -1,25 +1,23 @@
 import os, sys
-import subprocess
+from MonetDBtesting import process
 
-def client(cmd, input = None):
-    clt = subprocess.Popen(cmd,
-                           shell = True,
-                           stdin = subprocess.PIPE,
-                           stdout = subprocess.PIPE,
-                           stderr = subprocess.PIPE,
-                           universal_newlines = True)
+def client(lang, user = None, passwd = None, input = None):
+    clt = process.client(lang, user = user, passwd = passwd,
+                         stdin = process.PIPE,
+                         stdout = process.PIPE,
+                         stderr = process.PIPE)
     out, err = clt.communicate(input)
     sys.stdout.write(out)
     sys.stderr.write(err)
 
 def main():
     sql_client = os.getenv('SQL_CLIENT')
-    client(sql_client, """\
+    client('sql', input = """\
 create user voc with password 'voc' name 'VOC Explorer' schema sys;
 create schema voc authorization voc;
 alter user voc set schema voc;
 """)
-    client('%s -uvoc -Pvoc' % sql_client, """\
+    client('sql', user = 'voc', passwd = 'voc', input = """\
 create table foo (
         id int,
         v int,
@@ -32,12 +30,12 @@
 );
 create trigger a after insert on foo insert into a values (1);
 """)
-    client(sql_client, """\
+    client('sql', input = """\
 create user test with password 'test' name 'Test User' schema sys;
 create schema test authorization test;
 alter user test set schema test;
 """)
-    client('%s -utest -Ptest' % sql_client, '''\
+    client('sql', user = 'test', passwd = 'test', input = '''\
 create table foo (
         id int,
         v int,
@@ -52,8 +50,8 @@
 create trigger test.x after insert on foo insert into a values (1);
 create trigger "test"."z" after insert on "foo" insert into a values (1);
 ''')
-    client(os.getenv('SQLDUMP'))
-    client('%s -uvoc -Pvoc' % os.getenv('SQLDUMP'))
-    client('%s -utest -Ptest' % os.getenv('SQLDUMP'))
+    client('sqldump')
+    client('sqldump', user = 'voc', passwd = 'voc')
+    client('sqldump', user = 'test', passwd = 'test')
 
 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