Commits

Henrik Vendelbo committed 20d5f66

fixed installation help

  • Participants
  • Parent commits a2ad762

Comments (0)

Files changed (2)

File pypy/module/installation/app_commands.py

 class HelpWrapper(CommandWrapper):
     """Not sure if this should replace the special help handling"""
     
+    def run_from_argv(self, argv):
+        from optparse import make_option, OptionParser
+
+        parser = OptionParser(prog=sys.executable_name,
+                            usage='',
+                            version=self.get_version(),
+                            option_list=self.option_list)
+        options, args = parser.parse_args(argv[2:])
+        return self(*args, **options.__dict__)
+
     def __call__(self,*args,**options):
         if len(args) > 0:
             text = COMMANDS[args[0]].format_help(sys.product_name, args[0])

File pypy/module/installation/test/test_execute.py

     
     def test_main_help(self):
         import installation
-        test_wrap = installation.commands['test']
         wrap = installation.commands['help']
-        text, level = wrap.run_from_argv(['','help','test'])
+        text, level = wrap.run_from_argv(['','help'])
         assert level == 1
         assert text == """\
 pypyexe <subcommand> [options] [args]
         wrap = installation.commands['help']
         text, level = wrap.run_from_argv(['','help','testclass'])
         # assert wrap.cmd.call_args ==
-        assert text == """\
+        
+        expectation = """\
 Usage: pypyexe testclass [options] [installation]
 
 %s
 Options:
   --version   show program's version number and exit
   -h, --help  show this help message and exit
-""" % testclass_wrap.cmd.help
+"""  
+        assert text == expectation % testclass_wrap.cmd.help
 
         test_wrap = installation.commands['test']
         wrap = installation.commands['help']