|
From: <ct...@us...> - 2013-04-22 08:28:32
|
Revision: 1946
http://sourceforge.net/p/colorer/svn/1946
Author: ctapmex
Date: 2013-04-22 08:28:29 +0000 (Mon, 22 Apr 2013)
Log Message:
-----------
Allow selective testing with filter globs on command-line
Modified Paths:
--------------
trunk/schemes/hrc/changelog
trunk/schemes/hrc/test/runtest.py
Modified: trunk/schemes/hrc/changelog
===================================================================
--- trunk/schemes/hrc/changelog 2013-04-22 08:22:20 UTC (rev 1945)
+++ trunk/schemes/hrc/changelog 2013-04-22 08:28:29 UTC (rev 1946)
@@ -1,5 +1,10 @@
$Revision$
$Author$ $Date$
+ - runtest.py: Allow selective testing with filter globs on command-line (Vladimir Panteleev)
+ - runtest.py: Fix newline conversion (Vladimir Panteleev)
+
+#Revision: 1945
+ #Author: ctapmex Date: 2013-04-22 14:22:20 +0600 (Пн, 22 апр 2013)
- поправлена jscript
- новые расширения и опечатки
Modified: trunk/schemes/hrc/test/runtest.py
===================================================================
--- trunk/schemes/hrc/test/runtest.py 2013-04-22 08:22:20 UTC (rev 1945)
+++ trunk/schemes/hrc/test/runtest.py 2013-04-22 08:28:29 UTC (rev 1946)
@@ -14,13 +14,14 @@
import os, sys
import copy
import difflib
-import optparse
-import subprocess
-import unittest
-from datetime import datetime
-from os.path import abspath, dirname, join, normpath
+import optparse
+import subprocess
+import unittest
+import fnmatch
+from datetime import datetime
+from os.path import abspath, dirname, join, normpath
+
-
# -- path setup --
tests_path = normpath(dirname(__file__))
root_path = join(tests_path, "..", "..")
@@ -47,13 +48,13 @@
sys.exit("Exiting: Test dir already exists - %s" % current_dir)
os.mkdir(current_dir)
-
-# -- args parsing --
-
-usage = "%prog [--quick]"
-
-opt = optparse.OptionParser(usage=usage, add_help_option=False)
-opt.add_option("--quick", action="store_true", help="exclude /full/ dirs from testing")
+
+# -- args parsing --
+
+usage = "%prog [--quick] [GLOB...]"
+
+opt = optparse.OptionParser(usage=usage, add_help_option=False)
+opt.add_option("--quick", action="store_true", help="exclude /full/ dirs from testing")
opt.add_option("--help", action="store_true")
#opt.add_option("--list", action="store_true")
(options, args) = opt.parse_args()
@@ -102,13 +103,20 @@
if options.quick:
if "full" in dirs:
dirs.remove("full")
- if root == tests_path:
- continue
- for name in files:
- test_list.append(normpath(join(root, name)))
-
-failed = 0
-for no, test in enumerate(test_list):
+ if root == tests_path:
+ continue
+ for name in files:
+ path = normpath(join(root, name))
+ if len(args):
+ for glob in args:
+ if fnmatch.fnmatch(path, glob):
+ break
+ else:
+ continue # next file
+ test_list.append(path)
+
+failed = 0
+for no, test in enumerate(test_list):
print "Processing (%s/%s) %s" % (no+1, len(test_list), test)
origname = join(valid_dir, test)
@@ -136,13 +144,13 @@
# XXX: colorer.exe compiled with MinGW produces output with unix line ends
# but SVN checkout is made with unix ones. Converting lineends here
# until it's clear which lineends are generated by VS compiled version.
- if os.name == 'nt':
- with open(outname) as fr:
- lines = fr.readlines()
- with open(outname, "w") as fw:
- fw.writelines(lines)
-
- diff = filediff("%s.html" % origname, outname)
+ if os.name == 'nt':
+ with open(outname) as fr:
+ lines = fr.readlines()
+ with open(outname, "wb") as fw:
+ fw.writelines(lines)
+
+ diff = filediff("%s.html" % origname, outname)
for line in diff:
fail_log.write(line)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|