Skip to content

Commit 0c27875

Browse files
committed
missed clears and adjusting tests
1 parent 795ac64 commit 0c27875

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

sqlmesh/core/context.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,8 @@ def load(self, update_schemas: bool = True) -> GenericContext[C]:
639639
self._excluded_requirements.clear()
640640
self._linters.clear()
641641
self._environment_statements = []
642+
self._models_with_tests.clear()
643+
self._model_test_metadata.clear()
642644

643645
for loader, project in zip(self._loaders, loaded_projects):
644646
self._jinja_macros = self._jinja_macros.merge(project.jinja_macros)

tests/core/test_test.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,13 +2469,12 @@ def copy_test_file(test_file: Path, new_test_file: Path, index: int) -> None:
24692469
"SELECT 1 AS col_1, 2 AS col_2, 3 AS col_3, 4 AS col_4, 5 AS col_5, 6 AS col_6, 7 AS col_7"
24702470
)
24712471

2472-
context.upsert_model(
2473-
_create_model(
2474-
meta="MODEL(name test.test_wide_model)",
2475-
query=wide_model_query,
2476-
default_catalog=context.default_catalog,
2477-
)
2472+
wide_model = _create_model(
2473+
meta="MODEL(name test.test_wide_model)",
2474+
query=wide_model_query,
2475+
default_catalog=context.default_catalog,
24782476
)
2477+
context.upsert_model(wide_model)
24792478

24802479
tests_dir = tmp_path / "tests"
24812480
tests_dir.mkdir()
@@ -2499,6 +2498,9 @@ def copy_test_file(test_file: Path, new_test_file: Path, index: int) -> None:
24992498

25002499
wide_test_file.write_text(wide_test_file_content)
25012500

2501+
context.load()
2502+
context.upsert_model(wide_model)
2503+
25022504
with capture_output() as captured_output:
25032505
context.test()
25042506

0 commit comments

Comments
 (0)