@@ -1539,6 +1539,9 @@ def test_gateway(copy_to_temp_path: t.Callable, mocker: MockerFixture) -> None:
15391539 with open (test_path , "w" , encoding = "utf-8" ) as file :
15401540 dump_yaml (test_dict , file )
15411541
1542+ # Re-initialize context to pick up the modified test file
1543+ context = Context (paths = path , config = config )
1544+
15421545 spy_execute = mocker .spy (EngineAdapter , "_execute" )
15431546 mocker .patch ("sqlmesh.core.test.definition.random_id" , return_value = "jzngz56a" )
15441547
@@ -2448,6 +2451,9 @@ def copy_test_file(test_file: Path, new_test_file: Path, index: int) -> None:
24482451 copy_test_file (original_test_file , tmp_path / "tests" / f"test_success_{ i } .yaml" , i )
24492452 copy_test_file (new_test_file , tmp_path / "tests" / f"test_failure_{ i } .yaml" , i )
24502453
2454+ # Re-initialize context to pick up the new test files
2455+ context = Context (paths = tmp_path , config = config )
2456+
24512457 with capture_output () as captured_output :
24522458 context .test ()
24532459
@@ -2549,6 +2555,9 @@ def copy_test_file(test_file: Path, new_test_file: Path, index: int) -> None:
25492555 """
25502556 )
25512557
2558+ # Re-initialize context to pick up the modified test file
2559+ context = Context (paths = tmp_path , config = config )
2560+
25522561 with capture_output () as captured_output :
25532562 context .test ()
25542563
@@ -3422,6 +3431,9 @@ def test_cte_failure(tmp_path: Path) -> None:
34223431 """
34233432 )
34243433
3434+ # Re-initialize context to pick up the new test file
3435+ context = Context (paths = tmp_path , config = config )
3436+
34253437 with capture_output () as captured_output :
34263438 context .test ()
34273439
@@ -3448,6 +3460,9 @@ def test_cte_failure(tmp_path: Path) -> None:
34483460 """
34493461 )
34503462
3463+ # Re-initialize context to pick up the modified test file
3464+ context = Context (paths = tmp_path , config = config )
3465+
34513466 with capture_output () as captured_output :
34523467 context .test ()
34533468
0 commit comments