@@ -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
@@ -3472,6 +3481,9 @@ def test_cte_failure(tmp_path: Path) -> None:
34723481 """
34733482 )
34743483
3484+ # Re-initialize context to pick up the new test file
3485+ context = Context (paths = tmp_path , config = config )
3486+
34753487 with capture_output () as captured_output :
34763488 context .test ()
34773489
@@ -3498,6 +3510,9 @@ def test_cte_failure(tmp_path: Path) -> None:
34983510 """
34993511 )
35003512
3513+ # Re-initialize context to pick up the modified test file
3514+ context = Context (paths = tmp_path , config = config )
3515+
35013516 with capture_output () as captured_output :
35023517 context .test ()
35033518
0 commit comments