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

Modified Files:
        role2.SQL.py 
Log Message:
propagated changes of Thursday Oct 15 2009 - Friday Oct 16 2009
from the Nov2009 branch to the development trunk

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2009/10/15 - sjoerd: src/test/Users/Tests/role2.SQL.py,1.6.8.2
  New module MonetDBtesting.process to make it easier to write tests in Python.
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Index: role2.SQL.py
===================================================================
RCS file: /cvsroot/monetdb/sql/src/test/Users/Tests/role2.SQL.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- role2.SQL.py        13 Oct 2009 14:11:29 -0000      1.9
+++ role2.SQL.py        16 Oct 2009 08:44:35 -0000      1.10
@@ -1,23 +1,12 @@
 import os, sys
-import copy
-import subprocess
-
-def client(cmd, env = os.environ):
-    clt = subprocess.Popen(cmd, env=env, 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 main():
-    testenv = copy.deepcopy(os.environ)
-    testenv['DOTMONETDBFILE'] = '.testuser'
-    f = open(testenv['DOTMONETDBFILE'], 'w')
-    f.write('user=my_user2\npassword=p2\n')
-    f.close()
-    clcmd = str(os.getenv('SQL_CLIENT')) + "< %s" % ('%s/../role.sql' % 
os.getenv('RELSRCDIR'))
-    client(clcmd, testenv)
-    os.unlink(testenv['DOTMONETDBFILE'])
+    clt = process.client('sql', user = 'my_user2', passwd = 'p2',
+                         stdin = open(os.path.join(os.getenv('RELSRCDIR'), 
'..', 'role.sql')),
+                         stdout = process.PIPE, stderr = process.PIPE)
+    out, err = clt.communicate()
+    sys.stdout.write(out)
+    sys.stderr.write(err)
 
 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