fix testability of main entry point

This commit is contained in:
Adrian Sampson 2014-02-13 13:56:26 -08:00
parent 276a09bad7
commit 4bb2622b9b
2 changed files with 3 additions and 6 deletions

View file

@ -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()

View file

@ -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):