Skip to content

Commit 2cca48f

Browse files
committed
fix test
1 parent d5e5acc commit 2cca48f

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

tests/core/test_context.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -689,9 +689,7 @@ def test_plan_apply_populates_cache(copy_to_temp_path, mocker):
689689
config_content = f.read()
690690

691691
# Add cache_dir to the test_config definition
692-
config_content = config_content.replace(
693-
'test_config = Config(\n gateways={"in_memory": GatewayConfig(connection=DuckDBConnectionConfig())},\n default_gateway="in_memory",\n plan=PlanConfig(\n auto_categorize_changes=CategorizerConfig(\n sql=AutoCategorizationMode.SEMI, python=AutoCategorizationMode.OFF\n )\n ),\n model_defaults=model_defaults,\n)',
694-
f"""test_config = Config(
692+
config_content += f"""test_config_cache_dir = Config(
695693
gateways={{"in_memory": GatewayConfig(connection=DuckDBConnectionConfig())}},
696694
default_gateway="in_memory",
697695
plan=PlanConfig(
@@ -701,14 +699,14 @@ def test_plan_apply_populates_cache(copy_to_temp_path, mocker):
701699
),
702700
model_defaults=model_defaults,
703701
cache_dir="{custom_cache_dir.as_posix()}",
704-
)""",
705-
)
702+
before_all=before_all,
703+
)"""
706704

707705
with open(config_py_path, "w") as f:
708706
f.write(config_content)
709707

710708
# Create context with the test config
711-
context = Context(paths=sushi_path, config="test_config")
709+
context = Context(paths=sushi_path, config="test_config_cache_dir")
712710
custom_cache_dir = context.cache_dir
713711
assert "custom_cache" in str(custom_cache_dir)
714712
assert (custom_cache_dir / "optimized_query").exists()
@@ -733,7 +731,7 @@ def test_plan_apply_populates_cache(copy_to_temp_path, mocker):
733731

734732
# New context should load same models and create the cache for optimized_query and model_definition
735733
initial_model_count = len(context.models)
736-
context2 = Context(paths=context.path, config="test_config")
734+
context2 = Context(paths=context.path, config="test_config_cache_dir")
737735
cached_model_count = len(context2.models)
738736

739737
assert initial_model_count == cached_model_count > 0

tests/core/test_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3211,7 +3211,7 @@ def test_restatement_plan_clears_correct_intervals_across_environments(tmp_path:
32113211
cron '@daily'
32123212
);
32133213
3214-
select account_id, name, date from test.external_table;
3214+
select 1 as account_id, date from test.external_table;
32153215
"""
32163216
with open(models_dir / "model1.sql", "w") as f:
32173217
f.write(model1)

0 commit comments

Comments
 (0)