javascriptlint-devel Mailing List for JavaScript Lint
Status: Beta
                
                Brought to you by:
                
                    matthiasmiller
                    
                
            You can subscribe to this list here.
| 2008 | Jan | Feb | Mar (6) | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec | 
|---|
| 
      
      
      From: Matthias M. <In...@Ja...> - 2008-03-31 23:48:40
      
     | 
| Jeff Balogh wrote: > In...@Ja... wrote: > >> Jeff Balogh wrote: >> >>> Attached is a patch that replaces getopt with optparse. >>> >>> I like optparse because it's more maintainable, the order of the options doesn't >>> matter, and you get the usage text for free. >>> >>> >> (Replying to list.) Looks good. Committed in r180, with a minor tweak to >> the usage for --unittest. >> >> -Matthias Miller >> > > What is the purpose of running the unittests with `sys.argv[:1]`? > > if options.unittest: > unittest.main(pyjsl.jsparse, argv=sys.argv[:1]) > > If you only want to pass the program name, `sys.argv[0]` would be clearer. > However, limiting argv to just the program name means you can't pass any command > line arguments to unittest (it takes --quiet or --verbose). > > I think it would be best to not include any argv parameter, unless there's > something I'm missing. Granted, the splice is a bit unclear; tweaked in r184. The problem is that both jsl.py and unittest.main are trying to parse the same command-line, and they don't understand each other's options. Right off, I'd suggest invoking the test loader/runner directly instead of using unittest.main, and handling --quiet and --verbose in jsl.py. (I don't see a big need to support running only certain tests until we have more of them.) | 
| 
      
      
      From: Jeff B. <its...@gm...> - 2008-03-31 23:12:59
      
     | 
| In...@Ja... wrote:
> Jeff Balogh wrote:
> > Attached is a patch that replaces getopt with optparse.
> >
> > I like optparse because it's more maintainable, the order of the options doesn't
> > matter, and you get the usage text for free.
> >   
> 
> (Replying to list.) Looks good. Committed in r180, with a minor tweak to 
> the usage for --unittest.
> 
> -Matthias Miller
What is the purpose of running the unittests with `sys.argv[:1]`?
    if options.unittest:
        unittest.main(pyjsl.jsparse, argv=sys.argv[:1])
If you only want to pass the program name, `sys.argv[0]` would be clearer.
However, limiting argv to just the program name means you can't pass any command
line arguments to unittest (it takes --quiet or --verbose).
I think it would be best to not include any argv parameter, unless there's
something I'm missing.
 | 
| 
      
      
      From: <In...@Ja...> - 2008-03-31 21:47:04
      
     | 
| Jeff Balogh wrote: > Little bugfix: __init__ expects an Exception as the first argument. > Good catch. Fixed in r181. -Matthias Miller | 
| 
      
      
      From: <In...@Ja...> - 2008-03-31 21:43:25
      
     | 
| Jeff Balogh wrote: > Attached is a patch that replaces getopt with optparse. > > I like optparse because it's more maintainable, the order of the options doesn't > matter, and you get the usage text for free. > (Replying to list.) Looks good. Committed in r180, with a minor tweak to the usage for --unittest. -Matthias Miller | 
| 
      
      
      From: Jeff B. <its...@gm...> - 2008-03-31 16:40:53
      
     | 
| Little bugfix: __init__ expects an Exception as the first argument. | 
| 
      
      
      From: Jeff B. <its...@gm...> - 2008-03-31 16:36:11
      
     | 
| Attached is a patch that replaces getopt with optparse. I like optparse because it's more maintainable, the order of the options doesn't matter, and you get the usage text for free. |