Commits

bb b...@gmx.de  committed fb96978 Draft

print usage info

  • Participants
  • Parent commits 6bd589c

Comments (0)

Files changed (2)

File araldo/server.py

             "Configuration file %s not found\n" % options.config,
             conf_file_opt
         )
-    return options, args
+    return parser, options, args
 
 
 def main():
     """ Server main method
     """
     try:
-        options, args = parse_args(sys.argv[1:])
+        parser, options, args = parse_args(sys.argv[1:])
     except OptionError as error:
         sys.stderr.write(str(error))
+        sys.stderr.write(parser.usage)
         sys.exit(1)
 
     config = Config.create(options.config)

File test/server_test.py

 def test_parse_args_explicit_conf_long_option():
     with patch.object(server.os.path, "exists") as ex:
         ex.return_value = True
-        options, args = server.parse_args(["--config", "myconf.yaml"])
+        parsre, options, args = server.parse_args(["--config", "myconf.yaml"])
         assert options.config == "myconf.yaml"
 
 
 def test_parse_args_explicit_conf():
     with patch.object(server.os.path, "exists") as ex:
         ex.return_value = True
-        options, args = server.parse_args(["-c", "myconf.yaml"])
+        parser, options, args = server.parse_args(["-c", "myconf.yaml"])
         assert options.config == "myconf.yaml"
 
 
 def test_parse_args_implicit_conf():
-    options, args = server.parse_args([])
+    parser, options, args = server.parse_args([])
     assert options.config == "araldo.yaml"
 
 
 def test_nonexistant_config_file():
-    options, args = server.parse_args([])
+    parser, options, args = server.parse_args([])
     with pytest.raises(OptionError):
         with patch.object(server.os.path, "exists") as ex:
             ex.return_value = False