diff --git a/rq/scripts/__init__.py b/rq/scripts/__init__.py index 071d9fe..43e195c 100644 --- a/rq/scripts/__init__.py +++ b/rq/scripts/__init__.py @@ -16,7 +16,8 @@ def add_standard_arguments(parser): help='The Redis database (default: 0)') parser.add_argument('--password', '-a', default=None, help='The Redis password (default: None)') - + parser.add_argument('--socket', '-s', default=None, + help='The Redis Unix socket') def read_config_file(module): """Reads all UPPERCASE variables defined in the given module file.""" diff --git a/rq/scripts/rqworker.py b/rq/scripts/rqworker.py index ccb5db7..2e00494 100755 --- a/rq/scripts/rqworker.py +++ b/rq/scripts/rqworker.py @@ -27,7 +27,6 @@ def parse_args(): parser.add_argument('--quiet', '-q', action='store_true', default=False, help='Show less output') parser.add_argument('--sentry-dsn', action='store', default=None, metavar='URL', help='Report exceptions to this Sentry DSN') parser.add_argument('queues', nargs='*', help='The queues to listen on (default: \'default\')') - parser.add_argument('--socket', '-s', default=None, help='Use Unix socket to connect') return parser.parse_args() diff --git a/tests/test_scripts.py b/tests/test_scripts.py index 027abe6..504cf96 100644 --- a/tests/test_scripts.py +++ b/tests/test_scripts.py @@ -30,3 +30,13 @@ class TestScripts(TestCase): args.socket = 'sock-from-arg' setup_default_arguments(args, settings) self.assertEqual(args.socket, 'sock-from-arg') + + def test_add_socket_argument(self): + caught = [] + + args = uFaking() + args.add_argument = lambda *args, **kw: caught.append(args) + + add_standard_arguments(args) + socket_parms = [e for e in caught if e[0] == '--socket'] + self.assertEqual([('--socket', '-s')], socket_parms)