コード例 #1
0
ファイル: run_tracker_test.py プロジェクト: zomglings/pants
def test_run_tracker_timing_output(**kwargs) -> None:
    with temporary_dir() as buildroot:
        with environment_as(PANTS_BUILDROOT_OVERRIDE=buildroot):
            run_tracker = RunTracker(create_options_bootstrapper([]).bootstrap_options)
            run_tracker.start(run_start_time=time.time(), specs=["::"])
            frozen_time = kwargs["frozen_time"]
            frozen_time.tick(delta=datetime.timedelta(seconds=1))
            run_tracker.end_run(PANTS_SUCCEEDED_EXIT_CODE)

            timings = run_tracker.get_cumulative_timings()
            assert timings[0]["label"] == "main"
            assert timings[0]["timing"] == 1.0
コード例 #2
0
ファイル: run_tracker_test.py プロジェクト: codealchemy/pants
def test_run_tracker_timing_output(tmp_path: Path, **kwargs) -> None:
    frozen_time = kwargs["frozen_time"]
    buildroot = tmp_path.as_posix()
    with environment_as(PANTS_BUILDROOT_OVERRIDE=buildroot):
        ob = create_options_bootstrapper([])
        run_tracker = RunTracker(ob.args, ob.bootstrap_options)
        run_tracker.start(run_start_time=time.time(), specs=["::"])
        frozen_time.tick(delta=datetime.timedelta(seconds=1))
        run_tracker.end_run(PANTS_SUCCEEDED_EXIT_CODE)

        timings = run_tracker.get_cumulative_timings()
        assert timings[0]["label"] == "main"
        assert timings[0]["timing"] == 1.0