Example #1
0
def test_prepare_scheduler():
    # A core with no services.
    def create_services(bootstrap_options, legacy_graph_scheduler):
        return PantsServices()

    core = PantsDaemonCore(create_options_bootstrapper([]), PyExecutor(2, 4),
                           create_services)

    first_scheduler, first_options_initializer = core.prepare(
        create_options_bootstrapper(["-ldebug"]))
    second_scheduler, second_options_initializer = core.prepare(
        create_options_bootstrapper(["-lwarn"]))
    assert first_scheduler is not second_scheduler
    assert first_options_initializer is second_options_initializer
Example #2
0
def test_prepare_scheduler() -> None:
    # A core with no services.
    def create_services(bootstrap_options, graph_scheduler):
        return PantsServices()

    env = CompleteEnvironment({})
    core = PantsDaemonCore(
        create_options_bootstrapper([]),
        PyExecutor(core_threads=2, max_threads=4),
        create_services,
    )

    first_scheduler, first_options_initializer = core.prepare(
        create_options_bootstrapper(["-ldebug"]),
        env,
    )
    second_scheduler, second_options_initializer = core.prepare(
        create_options_bootstrapper(["-lwarn"]),
        env,
    )
    assert first_scheduler is not second_scheduler
    assert first_options_initializer is second_options_initializer