22from unittest import mock
33
44import pytest
5- import time_machine
65from pathlib import Path
76from sqlglot import exp
87from sqlglot .optimizer .qualify_columns import quote_identifiers
@@ -474,7 +473,6 @@ def test_plan_correlation_id_in_job_labels(ctx: TestContext):
474473 assert labels == {correlation_id .job_type .value .lower (): correlation_id .job_id }
475474
476475
477- @time_machine .travel ("2023-01-08 15:00:00 UTC" )
478476def test_run_correlation_id_in_job_labels (ctx : TestContext ):
479477 run_id = "test_run_id"
480478 model_name = ctx .table ("run_test" )
@@ -497,7 +495,7 @@ def test_run_correlation_id_in_job_labels(ctx: TestContext):
497495 )
498496 )
499497 )
500- sqlmesh .plan (auto_apply = True , no_prompts = True )
498+ sqlmesh .plan (auto_apply = True , no_prompts = True , execution_time = "2023-01-08 15:00:00" )
501499
502500 captured_evaluators : t .List = []
503501 original_scheduler = sqlmesh .scheduler
@@ -510,12 +508,9 @@ def scheduler_wrapper(
510508 captured_evaluators .append (snapshot_evaluator )
511509 return original_scheduler (environment = environment , snapshot_evaluator = snapshot_evaluator )
512510
513- with time_machine .travel ("2023-01-09 00:00:00 UTC" ):
514- with mock .patch (
515- "sqlmesh.core.context.analytics.collector.on_run_start" , return_value = run_id
516- ):
517- with mock .patch .object (sqlmesh , "scheduler" , scheduler_wrapper ):
518- sqlmesh .run ()
511+ with mock .patch ("sqlmesh.core.context.analytics.collector.on_run_start" , return_value = run_id ):
512+ with mock .patch .object (sqlmesh , "scheduler" , scheduler_wrapper ):
513+ sqlmesh .run (execution_time = "2023-01-09 00:00:00" )
519514
520515 assert captured_evaluators
521516 adapter = t .cast (BigQueryEngineAdapter , captured_evaluators [- 1 ].adapter )
0 commit comments