From 9694902d4cdd8c99c32271ed3c696082dc1c486f 2015-08-16 19:36:40 From: Lance Edgar Date: 2015-08-16 19:36:40 Subject: [PATCH] Remove some unused/unwanted command line arguments. These weren't bad ideas, but hadn't really been implemented. Easier just to get rid of them for now. --- diff --git a/rattail/commands.py b/rattail/commands.py index f4aa94f5e0a6da14803b75495d1901472874a419..a54a3f4feb1e089f3d6df044918ae68f1ce9e994 100644 --- a/rattail/commands.py +++ b/rattail/commands.py @@ -96,7 +96,7 @@ class Command(object): long_description = """ Rattail is a retail software framework. -Copyright (c) 2010-2012 Lance Edgar +Copyright (c) 2010-2015 Lance Edgar This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. @@ -181,14 +181,12 @@ Commands:\n""".format(self.description, self.name)) parser.add_argument('-c', '--config', action='append', dest='config_paths', metavar='PATH') - parser.add_argument('-d', '--debug', action='store_true', dest='debug') parser.add_argument('-n', '--no-init', action='store_true', default=False) parser.add_argument('-P', '--progress', action='store_true', default=False) parser.add_argument('--stdout', metavar='PATH', type=argparse.FileType('w'), help="Optional path to which STDOUT should be effectively redirected.") parser.add_argument('--stderr', metavar='PATH', type=argparse.FileType('w'), help="Optional path to which STDERR should be effectively redirected.") - parser.add_argument('-v', '--verbose', action='store_true', dest='verbose') parser.add_argument('-V', '--version', action='version', version="%(prog)s {0}".format(self.version)) parser.add_argument('command', nargs='*') @@ -232,23 +230,12 @@ Commands:\n""".format(self.description, self.name)) # edbob.basic_logging() logging.basicConfig() - if args.verbose: - log.setLevel(logging.INFO) - if args.debug: - log.setLevel(logging.DEBUG) - # Initialize everything... config = None if not args.no_init: edbob.init(self.name, *(args.config_paths or [])) config = RattailConfig(edbob.config) - # Command line logging flags should override config. - if args.verbose: - log.setLevel(logging.INFO) - if args.debug: - log.setLevel(logging.DEBUG) - # Configure the default database engine. try: from rattail.db.util import configure_session_factory diff --git a/tests/test_commands.py b/tests/test_commands.py index 3be5cad7b47e737ef4587971da5e0c832b4746b6..9b818ffd5e6b73022065bb16d944fad9c6b26481 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -134,24 +134,6 @@ class TestCommand(TestCase): with open(err_path) as f: self.assertEqual(f.read(), "standard error stuff") - def test_verbose_flag_sets_root_logging_level_to_info(self): - self.assertEqual(logging.getLogger().getEffectiveLevel(), logging.NOTSET) - tmp = TempIO() - config_path = tmp.putfile('test.ini', '') - command = commands.Command() - fake = command.subcommands['fake'] = Mock() - command.run('fake', '--config', config_path, '--verbose') - self.assertEqual(logging.getLogger().getEffectiveLevel(), logging.INFO) - - def test_debug_flag_sets_root_logging_level_to_debug(self): - self.assertEqual(logging.getLogger().getEffectiveLevel(), logging.NOTSET) - tmp = TempIO() - config_path = tmp.putfile('test.ini', '') - command = commands.Command() - fake = command.subcommands['fake'] = Mock() - command.run('fake', '--config', config_path, '--debug') - self.assertEqual(logging.getLogger().getEffectiveLevel(), logging.DEBUG) - def test_noinit_flag_means_no_config(self): command = commands.Command() fake = command.subcommands['fake'] = Mock()