MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_excinfo_no_python_sourcecode

Function test_excinfo_no_python_sourcecode

testing/code/test_excinfo.py:367–380  ·  view source on GitHub ↗
(tmp_path: Path)

Source from the content-addressed store, hash-verified

365
366
367def test_excinfo_no_python_sourcecode(tmp_path: Path) -> None:
368 # XXX: simplified locally testable version
369 tmp_path.joinpath("test.txt").write_text("{{ h()}}:")
370
371 jinja2 = pytest.importorskip("jinja2")
372 loader = jinja2.FileSystemLoader(str(tmp_path))
373 env = jinja2.Environment(loader=loader)
374 template = env.get_template("test.txt")
375 excinfo = pytest.raises(ValueError, template.render, h=h)
376 for item in excinfo.traceback:
377 print(item) # XXX: for some reason jinja.Template.render is printed in full
378 item.source # shouldn't fail
379 if isinstance(item.path, Path) and item.path.name == "test.txt":
380 assert str(item.source) == "{{ h()}}:"
381
382
383def test_entrysource_Queue_example():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected