add a command line option to deactive background downloads
This commit is contained in:
Родитель
5a02b53791
Коммит
e9a2df5851
|
@ -247,7 +247,8 @@ class Bisector(object):
|
|||
FINISHED = 2
|
||||
USER_EXIT = 3
|
||||
|
||||
def __init__(self, fetch_config, test_runner, persist=None):
|
||||
def __init__(self, fetch_config, test_runner, persist=None,
|
||||
dl_in_background=True):
|
||||
self.fetch_config = fetch_config
|
||||
self.test_runner = test_runner
|
||||
self.delete_dldir = False
|
||||
|
@ -257,7 +258,7 @@ class Bisector(object):
|
|||
persist = tempfile.mkdtemp()
|
||||
self.delete_dldir = True
|
||||
self.download_dir = persist
|
||||
self.download_background = True
|
||||
self.dl_in_background = dl_in_background
|
||||
|
||||
def __del__(self):
|
||||
if self.delete_dldir:
|
||||
|
@ -306,7 +307,7 @@ class Bisector(object):
|
|||
# note that we don't have to worry if builds are already
|
||||
# downloaded, or if our build infos are the same because
|
||||
# this will be handled by the downloadmanager.
|
||||
if self.download_background:
|
||||
if self.dl_in_background:
|
||||
def start_dl(r):
|
||||
# first get the next mid point
|
||||
# this will trigger some blocking downloads
|
||||
|
@ -385,7 +386,8 @@ class BisectRunner(object):
|
|||
self.fetch_config = fetch_config
|
||||
self.options = options
|
||||
self.bisector = Bisector(fetch_config, test_runner,
|
||||
persist=options.persist)
|
||||
persist=options.persist,
|
||||
dl_in_background=options.background_dl)
|
||||
self._logger = get_default_logger('Bisector')
|
||||
|
||||
def do_bisect(self, handler, good, bad, **kwargs):
|
||||
|
|
|
@ -183,6 +183,13 @@ def parse_args(argv=None):
|
|||
" %(default)s seconds - increase this if you"
|
||||
" are under a really slow network."))
|
||||
|
||||
parser.add_argument('--no-background-dl', action='store_false',
|
||||
dest="background_dl",
|
||||
default=(defaults.get('no-background-dl', '').lower()
|
||||
not in ('1', 'yes', 'true')),
|
||||
help=("Do not download next builds in the background"
|
||||
" while evaluating the current build."))
|
||||
|
||||
commandline.add_logging_group(parser)
|
||||
options = parser.parse_args(argv)
|
||||
options.bits = parse_bits(options.bits)
|
||||
|
|
|
@ -241,7 +241,8 @@ class TestBisector(unittest.TestCase):
|
|||
def setUp(self):
|
||||
self.handler = MagicMock(find_fix=False)
|
||||
self.test_runner = Mock()
|
||||
self.bisector = Bisector(Mock(), self.test_runner)
|
||||
self.bisector = Bisector(Mock(), self.test_runner,
|
||||
dl_in_background=False)
|
||||
self.bisector.download_background = False
|
||||
self.dl_manager = Mock()
|
||||
|
||||
|
|
|
@ -190,6 +190,14 @@ class TestMainCli(unittest.TestCase):
|
|||
assert_called_with(utils.parse_date(good[1]),
|
||||
utils.parse_date(bad[1]))
|
||||
|
||||
def test_download_in_background_is_on_by_default(self):
|
||||
self.do_cli([])
|
||||
self.assertTrue(self.runner.options.background_dl)
|
||||
|
||||
def test_deactive_download_in_background(self):
|
||||
self.do_cli(['--no-background-dl'])
|
||||
self.assertFalse(self.runner.options.background_dl)
|
||||
|
||||
|
||||
class TestResumeInfoBisectRunner(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
|
Загрузка…
Ссылка в новой задаче