[py-svn] r38396 - in py/trunk/py: bin misc/testing

guido at codespeak.net guido at codespeak.net
Sat Feb 10 16:41:32 CET 2007


Author: guido
Date: Sat Feb 10 16:41:31 2007
New Revision: 38396

Modified:
   py/trunk/py/bin/_update_website.py
   py/trunk/py/misc/testing/test_update_website.py
Log:
Capturing stdout and stderr when running the update_website tests to not mess
up --rest output.


Modified: py/trunk/py/bin/_update_website.py
==============================================================================
--- py/trunk/py/bin/_update_website.py	(original)
+++ py/trunk/py/bin/_update_website.py	Sat Feb 10 16:41:31 2007
@@ -22,7 +22,7 @@
     rs.add_target(gateway, remotepath, delete=True)
     rs.send()
 
-def run_tests(pkgpath, args=''):
+def run_tests(pkgpath, args='', captureouterr=False):
     """ run the unit tests and build the docs """
     pypath = py.__package__.getpath()
     pytestpath = pypath.join('bin/py.test')
@@ -32,13 +32,16 @@
     apigenpath = pkgpath.join('apigen/apigen.py') # XXX be more general here?
     if not apigenpath.check(file=True):
         apigenpath = pypath.join('apigen/apigen.py')
-    cmd = 'PYTHONPATH="%s:%s" python "%s" --apigen="%s" "%s" %s' % (
+    cmd = 'PYTHONPATH="%s:%s" python "%s" %s --apigen="%s" "%s"' % (
                                                              pypath.dirpath(),
                                                              pkgpath.dirpath(),
                                                              pytestpath,
+                                                             args,
                                                              apigenpath,
                                                              pkgpath,
-                                                             args)
+                                                             )
+    if captureouterr:
+        cmd += ' > /dev/null 2>&1'
     status = py.std.os.system(cmd)
     return status
 

Modified: py/trunk/py/misc/testing/test_update_website.py
==============================================================================
--- py/trunk/py/misc/testing/test_update_website.py	(original)
+++ py/trunk/py/misc/testing/test_update_website.py	Sat Feb 10 16:41:31 2007
@@ -52,7 +52,7 @@
     if py.std.sys.platform == "win32":
         py.test.skip("update_website is not supposed to be run from win32")
     pkgpath = setup_pkg('update_website_run_tests')
-    errors = update_website.run_tests(pkgpath)
+    errors = update_website.run_tests(pkgpath, captureouterr=True)
     assert not errors
     assert pkgpath.join('../apigen').check(dir=True)
     assert pkgpath.join('../apigen/api/sub.foo.html').check(file=True)
@@ -63,6 +63,6 @@
     pkgpath = setup_pkg('update_website_run_tests_failure')
     assert not pkgpath.join('../apigen').check(dir=True)
     pkgpath.ensure('../apigen', file=True)
-    errors = update_website.run_tests(pkgpath, '> /dev/null 2>&1')
+    errors = update_website.run_tests(pkgpath, captureouterr=True)
     assert errors # some error message
 



More information about the pytest-commit mailing list