[kupfer] wscript: Run 'waf test' using $PYTHON from environment



commit dd9ca50838ba2d9e398b33c90318d65e8fb31228
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Sun Sep 27 16:03:41 2009 +0200

    wscript: Run 'waf test' using $PYTHON from environment
    
    This makes it possible to run the (very limited) tests for any python
    version.
    
    NOTE: Passing tests does not mean that kupfer works with that version
    of Python; only that the tested functions work.

 wscript |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/wscript b/wscript
index 0334066..db7592d 100644
--- a/wscript
+++ b/wscript
@@ -194,11 +194,19 @@ def intlupdate(util):
 
 def test(bld):
 	# find all files with doctests
+	python = os.getenv("PYTHON", "python")
 	paths = os.popen("git grep -l 'doctest.testmod()' kupfer/").read().split()
 	all_success = True
+	verbose = ("-v" in sys.argv)
 	for p in paths:
 		print p
-		res = os.popen("python '%s'" % p).read()
+		cmd = [python, p]
+		if verbose:
+			cmd.append("-v")
+		sin, souterr = os.popen4(cmd)
+		sin.close()
+		res = souterr.read()
+		souterr.close()
 		print (res or "OK")
 		all_success = all_success and bool(res)
 	return all_success



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]