From 9ab9166c8d5859fad53fd8a3ff422c6ff317b8b3 Mon Sep 17 00:00:00 2001 From: Johnny Robeson Date: Mon, 25 Jul 2016 00:43:33 -0400 Subject: [PATCH] add a lib keyword arg to the run_command test helper Now a `Library` instance can be passed to run_command as a keyword argument. --- test/helper.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/helper.py b/test/helper.py index a0f126b0f..69b2627db 100644 --- a/test/helper.py +++ b/test/helper.py @@ -421,10 +421,16 @@ class TestHelper(object): # Running beets commands - def run_command(self, *args): + def run_command(self, *args, **kwargs): + """Run a beets command with an arbitrary amount of arguments. The + Library` defaults to `self.lib`, but can be overridden with + the keyword argument `lib`. + """ sys.argv = ['beet'] # avoid leakage from test suite args + lib = None if hasattr(self, 'lib'): lib = self.lib + lib = kwargs.get('lib', lib) beets.ui._raw_main(list(args), lib) def run_with_output(self, *args):