Thread: [javascriptlint-commit] SF.net SVN: javascriptlint: [163] trunk/jsl.py
Status: Beta
Brought to you by:
matthiasmiller
|
From: <mat...@us...> - 2008-03-04 03:40:13
|
Revision: 163
http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=163&view=rev
Author: matthiasmiller
Date: 2008-03-03 19:37:22 -0800 (Mon, 03 Mar 2008)
Log Message:
-----------
fix pyjsl.jsparse imports
Modified Paths:
--------------
trunk/jsl.py
Modified: trunk/jsl.py
===================================================================
--- trunk/jsl.py 2008-03-04 03:10:46 UTC (rev 162)
+++ trunk/jsl.py 2008-03-04 03:37:22 UTC (rev 163)
@@ -14,7 +14,7 @@
sys.path.append(setup.get_lib_path())
import pyjsl.conf
-import pyjsl.parse
+import pyjsl.jsparse
import pyjsl.util
import test
@@ -52,7 +52,7 @@
def _dump(paths):
for path in paths:
script = pyjsl.util.readfile(path)
- pyjsl.parse.dump_tree(script)
+ pyjsl.jsparse.dump_tree(script)
def _lint(paths, conf):
def lint_error(path, line, col, errname):
@@ -124,7 +124,7 @@
if opt in ('-t', '--test'):
profile_func(run_tests)
if opt in ('--unittest',):
- unittest.main(pyjsl.parse, argv=sys.argv[:1])
+ unittest.main(pyjsl.jsparse, argv=sys.argv[:1])
if opt in ('--profile',):
profile_func = profile_enabled
if opt in ('--conf',):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2008-03-20 21:38:52
|
Revision: 177
http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=177&view=rev
Author: matthiasmiller
Date: 2008-03-20 14:38:49 -0700 (Thu, 20 Mar 2008)
Log Message:
-----------
tests: print the file name only once
Modified Paths:
--------------
trunk/jsl.py
Modified: trunk/jsl.py
===================================================================
--- trunk/jsl.py 2008-03-20 21:38:16 UTC (rev 176)
+++ trunk/jsl.py 2008-03-20 21:38:49 UTC (rev 177)
@@ -43,7 +43,6 @@
if file.endswith('.htm') or file.endswith('.html'):
continue #TODO
elif file.endswith('.js'):
- print file
try:
test.run(file)
except test.TestError, error:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2008-03-31 21:39:39
|
Revision: 180
http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=180&view=rev
Author: matthiasmiller
Date: 2008-03-31 14:39:34 -0700 (Mon, 31 Mar 2008)
Log Message:
-----------
Replace getopt with optparse.
Patch by: Jeff Balogh <its.jeff.balogh at gmail.com>
Modified Paths:
--------------
trunk/jsl.py
Modified: trunk/jsl.py
===================================================================
--- trunk/jsl.py 2008-03-31 14:01:17 UTC (rev 179)
+++ trunk/jsl.py 2008-03-31 21:39:34 UTC (rev 180)
@@ -1,10 +1,10 @@
#!/usr/bin/python
import codecs
-import getopt
import glob
import os
import sys
import unittest
+from optparse import OptionParser
try:
import setup
@@ -95,46 +95,45 @@
def profile_disabled(func, *args, **kwargs):
func(*args, **kwargs)
-def usage():
- print """
-Usage:
- jsl [files]
- --help (-h) print this help
- --test (-t) run tests
- --dump= dump this script
-"""
-
if __name__ == '__main__':
- try:
- opts, args = getopt.getopt(sys.argv[1:], 'ht:v', ['conf=', 'help', 'test', 'dump', 'unittest', 'profile'])
- except getopt.GetoptError:
- usage()
- sys.exit(2)
+ parser = OptionParser(usage="%prog [options] [files]")
+ add = parser.add_option
+ add("--conf", dest="conf", metavar="CONF",
+ help="set the conf file")
+ add("-t", "--test", dest="test", action="store_true", default=False,
+ help="run the javascript tests")
+ add("--profile", dest="profile", action="store_true", default=False,
+ help="turn on hotshot profiling")
+ add("--dump", dest="dump", action="store_true", default=False,
+ help="dump this script")
+ add("--unittest", dest="unittest", action="store_true", default=False,
+ help="run the python unittests")
+ options, args = parser.parse_args()
- dump = False
+ if len(sys.argv) == 1:
+ parser.print_help()
+ sys.exit()
+
conf = pyjsl.conf.Conf()
+ if options.conf:
+ conf.loadfile(options.conf)
+
profile_func = profile_disabled
- for opt, val in opts:
- if opt in ('-h', '--help'):
- usage()
- sys.exit()
- if opt in ('--dump',):
- dump = True
- if opt in ('-t', '--test'):
- profile_func(run_tests)
- if opt in ('--unittest',):
- unittest.main(pyjsl.jsparse, argv=sys.argv[:1])
- if opt in ('--profile',):
- profile_func = profile_enabled
- if opt in ('--conf',):
- conf.loadfile(val)
+ if options.profile:
+ profile_func = profile_enabled
+ if options.unittest:
+ unittest.main(pyjsl.jsparse, argv=sys.argv[:1])
+
+ if options.test:
+ profile_func(run_tests)
+
paths = []
for recurse, path in conf['paths']:
paths.extend(_resolve_paths(path, recurse))
for arg in args:
paths.extend(_resolve_paths(arg, False))
- if dump:
+ if options.dump:
profile_func(_dump, paths)
else:
profile_func(_lint, paths, conf)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2008-03-31 23:47:16
|
Revision: 184
http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=184&view=rev
Author: matthiasmiller
Date: 2008-03-31 16:47:13 -0700 (Mon, 31 Mar 2008)
Log Message:
-----------
Clarify call to unittest.main.
Suggested by: Jeff Balogh <its.jeff.balogh at gmail.com>
Modified Paths:
--------------
trunk/jsl.py
Modified: trunk/jsl.py
===================================================================
--- trunk/jsl.py 2008-03-31 21:56:57 UTC (rev 183)
+++ trunk/jsl.py 2008-03-31 23:47:13 UTC (rev 184)
@@ -123,7 +123,7 @@
profile_func = profile_enabled
if options.unittest:
- unittest.main(pyjsl.jsparse, argv=sys.argv[:1])
+ unittest.main(pyjsl.jsparse, argv=[sys.argv[0]])
if options.test:
profile_func(run_tests)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mat...@us...> - 2008-04-01 01:54:12
|
Revision: 185
http://javascriptlint.svn.sourceforge.net/javascriptlint/?rev=185&view=rev
Author: matthiasmiller
Date: 2008-03-31 18:54:10 -0700 (Mon, 31 Mar 2008)
Log Message:
-----------
Stop using unittest.main to run unit tests and respect --quiet and --verbose.
Modified Paths:
--------------
trunk/jsl.py
Modified: trunk/jsl.py
===================================================================
--- trunk/jsl.py 2008-03-31 23:47:13 UTC (rev 184)
+++ trunk/jsl.py 2008-04-01 01:54:10 UTC (rev 185)
@@ -108,6 +108,11 @@
help="dump this script")
add("--unittest", dest="unittest", action="store_true", default=False,
help="run the python unittests")
+ add("--quiet", dest="verbosity", action="store_const", const=0,
+ help="minimal output")
+ add("--verbose", dest="verbosity", action="store_const", const=2,
+ help="verbose output")
+ parser.set_defaults(verbosity=1)
options, args = parser.parse_args()
if len(sys.argv) == 1:
@@ -123,7 +128,8 @@
profile_func = profile_enabled
if options.unittest:
- unittest.main(pyjsl.jsparse, argv=[sys.argv[0]])
+ runner = unittest.TextTestRunner(verbosity=options.verbosity)
+ runner.run(unittest.findTestCases(pyjsl.jsparse))
if options.test:
profile_func(run_tests)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|