Update of /cvsroot/monetdb/sql/src/test/Users/Tests
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv24424/src/test/Users/Tests
Modified Files:
role1.SQL.py role2.SQL.py table.SQL.py unknown_user.SQL.py
Log Message:
fix test scripts to work without -P option
U table.SQL.py
Index: table.SQL.py
===================================================================
RCS file: /cvsroot/monetdb/sql/src/test/Users/Tests/table.SQL.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- table.SQL.py 11 Dec 2008 13:42:48 -0000 1.6
+++ table.SQL.py 7 Oct 2009 11:59:12 -0000 1.7
@@ -1,4 +1,5 @@
import os, sys
+import copy
try:
import subprocess
except ImportError:
@@ -6,8 +7,8 @@
import MonetDBtesting.subprocess26 as subprocess
-def client(cmd):
- clt = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
+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())
@@ -16,7 +17,13 @@
def main():
- clcmd = str(os.getenv('SQL_CLIENT')) + " -umy_user -Pp1 < %s" %
('%s/../table.sql' % os.getenv('RELSRCDIR'))
+ testenv = copy.deepcopy(os.environ)
+ testenv['DOTMONETDBFILE'] = '.testuser'
+ f = open(testenv['DOTMONETDBFILE'], 'wb')
+ f.write('user=my_user\npassword=p1\n')
+ f.close()
+ clcmd = str(os.getenv('SQL_CLIENT')) + "< %s" % ('%s/../table.sql' %
os.getenv('RELSRCDIR'))
client(clcmd)
+ os.unlink(testenv['DOTMONETDBFILE'])
main()
U role1.SQL.py
Index: role1.SQL.py
===================================================================
RCS file: /cvsroot/monetdb/sql/src/test/Users/Tests/role1.SQL.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- role1.SQL.py 11 Dec 2008 13:42:48 -0000 1.6
+++ role1.SQL.py 7 Oct 2009 11:59:12 -0000 1.7
@@ -1,4 +1,5 @@
import os, sys
+import copy
try:
import subprocess
except ImportError:
@@ -6,8 +7,8 @@
import MonetDBtesting.subprocess26 as subprocess
-def client(cmd):
- clt = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
+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())
@@ -16,7 +17,13 @@
def main():
- clcmd = str(os.getenv('SQL_CLIENT')) + " -umy_user -Pp1 < %s" %
('%s/../role.sql' % os.getenv('RELSRCDIR'))
- client(clcmd)
+ testenv = copy.deepcopy(os.environ)
+ testenv['DOTMONETDBFILE'] = '.testuser'
+ f = open(testenv['DOTMONETDBFILE'], 'wb')
+ f.write('user=my_user\npassword=p1\n')
+ f.close()
+ clcmd = str(os.getenv('SQL_CLIENT')) + "< %s" % ('%s/../role.sql' %
os.getenv('RELSRCDIR'))
+ client(clcmd, testenv)
+ os.unlink(testenv['DOTMONETDBFILE'])
main()
U unknown_user.SQL.py
Index: unknown_user.SQL.py
===================================================================
RCS file: /cvsroot/monetdb/sql/src/test/Users/Tests/unknown_user.SQL.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- unknown_user.SQL.py 29 May 2007 12:14:15 -0000 1.1
+++ unknown_user.SQL.py 7 Oct 2009 11:59:12 -0000 1.2
@@ -1,5 +1,8 @@
import os, sys
-cltcmd = "%s -uthis_user_does_not_exist -Pthis_password_does_not_exist" %
(os.getenv('SQL_CLIENT'))
-
-os.system(cltcmd);
+os.environ['DOTMONETDBFILE'] = '.nouser'
+f = open(os.environ['DOTMONETDBFILE'], 'wb')
+f.write('user=this_user_does_not_exist\npassword=this_password_does_not_exist\n')
+f.close()
+os.system(os.getenv('SQL_CLIENT'))
+os.unlink(os.environ['DOTMONETDBFILE'])
U role2.SQL.py
Index: role2.SQL.py
===================================================================
RCS file: /cvsroot/monetdb/sql/src/test/Users/Tests/role2.SQL.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- role2.SQL.py 11 Dec 2008 13:42:48 -0000 1.6
+++ role2.SQL.py 7 Oct 2009 11:59:12 -0000 1.7
@@ -1,12 +1,13 @@
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):
- clt = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
+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())
@@ -14,7 +15,13 @@
def main():
- clcmd = str(os.getenv('SQL_CLIENT')) + " -umy_user2 -Pp2 < %s" %
('%s/../role.sql' % os.getenv('RELSRCDIR'))
- client(clcmd)
+ testenv = copy.deepcopy(os.environ)
+ testenv['DOTMONETDBFILE'] = '.testuser'
+ f = open(testenv['DOTMONETDBFILE'], 'wb')
+ 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'])
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