

def bisect_tests(bisection_label, options, test_labels):
    state = setup(int(options.verbosity), test_labels)
    if (not test_labels):
        from django.db.models.loading import get_apps
        test_labels = [app.__name__.split('.')[(- 2)] for app in get_apps()]
    print(('***** Bisecting test suite: %s' % ' '.join(test_labels)))
    for label in [bisection_label, 'model_inheritance_same_model_name']:
        try:
            test_labels.remove(label)
        except ValueError:
            pass
    subprocess_args = [sys.executable, upath(__file__), ('--settings=%s' % options.settings)]
    if options.failfast:
        subprocess_args.append('--failfast')
    if options.verbosity:
        subprocess_args.append(('--verbosity=%s' % options.verbosity))
    if (not options.interactive):
        subprocess_args.append('--noinput')
    iteration = 1
    while (len(test_labels) > 1):
        midpoint = (len(test_labels) / 2)
        test_labels_a = (test_labels[:midpoint] + [bisection_label])
        test_labels_b = (test_labels[midpoint:] + [bisection_label])
        print(('***** Pass %da: Running the first half of the test suite' % iteration))
        print(('***** Test labels: %s' % ' '.join(test_labels_a)))
        failures_a = subprocess.call((subprocess_args + test_labels_a))
        print(('***** Pass %db: Running the second half of the test suite' % iteration))
        print(('***** Test labels: %s' % ' '.join(test_labels_b)))
        print('')
        failures_b = subprocess.call((subprocess_args + test_labels_b))
        if (failures_a and (not failures_b)):
            print('***** Problem found in first half. Bisecting again...')
            iteration = (iteration + 1)
            test_labels = test_labels_a[:(- 1)]
        elif (failures_b and (not failures_a)):
            print('***** Problem found in second half. Bisecting again...')
            iteration = (iteration + 1)
            test_labels = label[:(- 1)]
        elif (failures_a and failures_b):
            print('***** Multiple sources of failure found')
            break
        else:
            print('***** No source of failure found... try pair execution (--pair)')
            break
    if (len(test_labels) == 1):
        print(('***** Source of error: %s' % test_labels[0]))
    teardown(state)

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/tests/runtests.py bisect_tests/VarMisuse@390/657 `test_labels_b`->`label`