예제 #1
0
 def make_runner(self, tasks, redis=None, pattern="*"):
     if redis is None:
         redis = self.mk_redis_config()
     args = tasks + [redis, pattern]
     options = Options()
     options.parseOptions(args)
     runner = TaskRunner(options)
     runner.redis._purge_all()   # Make sure we start fresh.
     runner.stdout = StringIO.StringIO()
     return runner
예제 #2
0
 def test_help(self):
     opts = Options()
     lines = opts.getUsage().splitlines()
     self.assertEqual(lines[-5:], [
         "Available tasks:",
         "      --count   A task that counts the number of keys.",
         "      --expire  A task that sets an expiry time on each key.",
         "      --list    A task that prints out each key.",
         "      --skip    A task that skips keys that match a regular"
         " expression.",
     ])
예제 #3
0
 def mk_opts_raw(self, args):
     opts = Options()
     opts.parseOptions(args)
     return opts