From 4bb2622b9b5e10e08157ba5645badf48b554d8fb Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Thu, 13 Feb 2014 13:56:26 -0800 Subject: [PATCH] fix testability of main entry point --- beets/ui/__init__.py | 6 +++--- test/test_ui.py | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index fad22efae..0ed8302e3 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -760,7 +760,7 @@ def _load_plugins(): plugins.send("pluginload") -def _configure(): +def _configure(args): """Parse the command line, load configuration files (including loading any indicated plugins), and return the invoked subcomand, the subcommand options, and the subcommand arguments. @@ -786,7 +786,7 @@ def _configure(): help='path to configuration file') # Parse the command-line! - options, args = optparse.OptionParser.parse_args(parser) + options, args = optparse.OptionParser.parse_args(parser, args) # Add any additional config files specified with --config. This # special handling lets specified plugins get loaded before we @@ -810,7 +810,7 @@ def _raw_main(args): """A helper function for `main` without top-level exception handling. """ - subcommand, suboptions, subargs = _configure() + subcommand, suboptions, subargs = _configure(args) # Open library file. dbpath = config['library'].as_filename() diff --git a/test/test_ui.py b/test/test_ui.py index 69a5a5754..e5cbf95a8 100644 --- a/test/test_ui.py +++ b/test/test_ui.py @@ -16,9 +16,7 @@ """ import os import shutil -import textwrap import re -import yaml import _common from _common import unittest @@ -30,7 +28,6 @@ from beets.autotag.match import distance from beets import importer from beets.mediafile import MediaFile from beets import config -from beets.util import confit from beets import plugins class ListTest(_common.TestCase):