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

Modified Files:
        set_history_and_drop_table.SF-2607045.SQL.py 
Log Message:
propagated changes of Friday Oct 09 2009
from the Nov2009 branch to the development trunk

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2009/10/09 - sjoerd:
          
src/test/BugTracker-2009/Tests/set_history_and_drop_table.SF-2607045.SQL.py,1.2.6.1
  propagated changes of Friday Oct 09 2009
  from the Aug2009 branch to the Nov2009 branch
  
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    2009/10/09 - sjoerd:
            
src/test/BugTracker-2009/Tests/set_history_and_drop_table.SF-2607045.SQL.py,1.2.4.1
    Replace use of os.popen by subprocess.Popen.  It seems on Windows the
    former doesn't inherit stdout which causes all these tests to fail
    there.
  
    In addition, some tests used some totally bizarre constructs.
  
    - If you create a process with a redirection from stdin (i.e. process
      < file), then it makes no sense to create a pipe to that process.
    - If you first replace the string port_num by some value and then to
      attempt to replace the string port_num5 by another value, then the
      second replace obviously has no effect.
    - If one process writes output to stdout (buffered!) and then starts a
      subprocess which also writes to the inherited stdout, then the
      buffered output of the parent process will come at the end, not
      where you might naively expect.
    - "<%s" % ('%s/../some-file' % dir) can be replaced with
      "<%s/../some-file" % dir (except that we should use os.path.join()
      here).
  
    Finally, cat | sed is not portable, so replaced that with a Python solution.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Index: set_history_and_drop_table.SF-2607045.SQL.py
===================================================================
RCS file: 
/cvsroot/monetdb/sql/src/test/BugTracker-2009/Tests/set_history_and_drop_table.SF-2607045.SQL.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- set_history_and_drop_table.SF-2607045.SQL.py        17 Feb 2009 00:57:08 
-0000      1.2
+++ set_history_and_drop_table.SF-2607045.SQL.py        9 Oct 2009 15:43:13 
-0000       1.3
@@ -1,17 +1,24 @@
 import os, sys
-
+try:
+    import subprocess
+except ImportError:
+    # use private copy for old Python versions
+    import MonetDBtesting.subprocess26 as subprocess
 
 def main():
     dir = os.getenv('TSTSRCDIR')
     clcmd = str(os.getenv('SQL_CLIENT'))
     sys.stdout.write('Load history\n')
-    clt1 = os.popen(clcmd + "<%s" % ('%s/../../../sql/history.sql' % dir), 'w')
-    clt1.close()
+    clt1 = subprocess.Popen(clcmd + ' "%s"' % os.path.join(dir,'..', 
'..','..','sql','history.sql'), shell = True, universal_newlines = True, stdout 
= subprocess.PIPE)
+    out, err = clt1.communicate()
+    sys.stdout.write(out)
     sys.stdout.write('Run test\n')
-    clt1 = os.popen(clcmd + "<%s" % 
('%s/../set_history_and_drop_table.SF-2607045.sql' % dir), 'w')
-    clt1.close()
+    clt1 = subprocess.Popen(clcmd + ' "%s"' % 
os.path.join(dir,'..','set_history_and_drop_table.SF-2607045.sql'), shell = 
True, universal_newlines = True, stdout = subprocess.PIPE)
+    out, err = clt1.communicate()
+    sys.stdout.write(out)
     sys.stdout.write('Drop history\n')
-    clt1 = os.popen(clcmd + "<%s" % ('%s/../drop_history.sql' % dir), 'w')
-    clt1.close()
+    clt1 = subprocess.Popen(clcmd + ' "%s"' % 
os.path.join(dir,'..','drop_history.sql'), shell = True, universal_newlines = 
True, stdout = subprocess.PIPE)
+    out, err = clt1.communicate()
+    sys.stdout.write(out)
 
 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