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

Modified Files:
        create.SQL.py 
Log Message:
fix test scripts to work without -P option

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
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- create.SQL.py       9 Jun 2009 07:53:55 -0000       1.3
+++ create.SQL.py       7 Oct 2009 11:59:12 -0000       1.4
@@ -1,12 +1,14 @@
 import os, sys
+import copy
 try:
     import subprocess
 except ImportError:
     # use private copy for old Python versions
     import MonetDBtesting.subprocess26 as subprocess
 
-def client(cmd, input = None):
+def client(cmd, input = None, env = os.environ):
     clt = subprocess.Popen(cmd,
+                           env = env,
                            shell = True,
                            stdin = subprocess.PIPE,
                            stdout = subprocess.PIPE,
@@ -23,7 +25,12 @@
 create schema voc authorization voc;
 alter user voc set schema voc;
 """)
-    client('%s -uvoc -Pvoc' % sql_client, """\
+    vocenv = copy.deepcopy(os.environ)
+    vocenv['DOTMONETDBFILE'] = '.vocuser'
+    f = open(vocenv['DOTMONETDBFILE'], 'wb')
+    f.write('user=voc\npassword=voc\n')
+    f.close()
+    client(sql_client, """\
 create table foo (
         id int,
         v int,
@@ -35,13 +42,18 @@
         id int
 );
 create trigger a after insert on foo insert into a values (1);
-""")
+""", vocenv)
     client(sql_client, """\
 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, '''\
+    testenv = copy.deepcopy(os.environ)
+    testenv['DOTMONETDBFILE'] = '.testuser'
+    f = open(testenv['DOTMONETDBFILE'], 'wb')
+    f.write('user=test\npassword=test\n')
+    f.close()
+    client(sql_client, '''\
 create table foo (
         id int,
         v int,
@@ -55,9 +67,11 @@
 create trigger a after insert on foo insert into a values (1);
 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);
-''')
+''', testenv)
     client(os.getenv('SQLDUMP'))
-    client('%s -uvoc -Pvoc' % os.getenv('SQLDUMP'))
-    client('%s -utest -Ptest' % os.getenv('SQLDUMP'))
+    client(os.getenv('SQLDUMP'), env = vocenv)
+    client(os.getenv('SQLDUMP'), env = testenv)
+    os.unlink(vocenv['DOTMONETDBFILE'])
+    os.unlink(testenv['DOTMONETDBFILE'])
 
 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