[pygobject] Make runtests.py able to run command-line provided test files



commit 3cca62a9e7afd3d3d302c66f4fafe253f7743d4e
Author: Steve Frécinaux <code istique net>
Date:   Wed Jan 19 15:00:56 2011 +0100

    Make runtests.py able to run command-line provided test files
    
    With this patch we are now able to run ./runtests.py <somefile>, which
    is more friendly than defining an environment variable to run some
    specific tests.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=639948

 tests/runtests.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/tests/runtests.py b/tests/runtests.py
old mode 100644
new mode 100755
index d99f0cc..5c2eded
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -1,10 +1,15 @@
+#!/usr/bin/env python
 # -*- Mode: Python -*-
 
 import os
 import glob
+import sys
 
 import unittest
 
+if '--help' in sys.argv:
+    print "Usage: ./runtests.py <testfiles>"
+    sys.exit(0)
 
 # Load tests.
 if 'TEST_NAMES' in os.environ:
@@ -13,6 +18,10 @@ elif 'TEST_FILES' in os.environ:
 	names = []
 	for filename in os.environ['TEST_FILES'].split():
 		names.append(filename[:-3])
+elif len(sys.argv) > 1:
+    names = []
+    for filename in sys.argv[1:]:
+        names.append(filename.replace('.py', ''))
 else:
 	names = []
 	for filename in glob.iglob("test_*.py"):



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