Skip to content

Commit a6a3900

Browse files
committed
Limit the zip lookup test to behaviour the fix changes
The error for a template found in no search path is the same as on main, so checking it tested behaviour this change does not touch, which is what the review pointed out. The test still checks that a zipped Dag loads templates from both its archive and a regular template_searchpath folder.
1 parent 5134638 commit a6a3900

1 file changed

Lines changed: 1 addition & 8 deletions

File tree

‎task-sdk/tests/task_sdk/definitions/_internal/test_templater.py‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -324,25 +324,18 @@ def test_loads_template_from_zip(self, tmp_path, archive_name, searchpath_parts,
324324

325325
assert env.get_template(template_name).render(x=1) == "SELECT 1"
326326

327-
def test_looks_up_templates_across_zip_and_directory_search_paths(self, tmp_path):
327+
def test_loads_templates_from_zip_and_directory_search_paths(self, tmp_path):
328328
archive = tmp_path / "dags.zip"
329329
with zipfile.ZipFile(archive, "w") as zf:
330330
zf.writestr("from_zip.sql", "from zip")
331331
directory = tmp_path / "templates"
332332
directory.mkdir()
333333
(directory / "from_dir.sql").write_text("from directory")
334334

335-
# The Dag folder always comes first in the search path, so a template kept outside the archive
336-
# is only found if a miss in the archive moves on to the next search path.
337335
env = create_template_env(searchpath=[str(archive), str(directory)])
338336

339337
assert env.get_template("from_zip.sql").render() == "from zip"
340338
assert env.get_template("from_dir.sql").render() == "from directory"
341-
with pytest.raises(jinja2.TemplateNotFound) as ctx:
342-
env.get_template("missing.sql")
343-
assert ctx.value.message == (
344-
f"'missing.sql' not found in search paths: {str(archive)!r}, {str(directory)!r}"
345-
)
346339

347340

348341
@pytest.fixture

0 commit comments

Comments
 (0)