Currently, jinja2 expects either _path defined or get_filenames: https://github.com/pallets/jinja/blob/master/src/jinja2/loaders.py#L262-L281
The pytest assertion rewriter defines neither (see https://github.com/pytest-dev/pytest/blob/master/src/_pytest/assertion/rewrite.py#L48), and as such running a test suite on a source code that has the following global:
from jinja2 import PackageLoader
LOADER = PackageLoader(__name__, "templates")
will fail with:
raise ValueError(
E ValueError: The 'xxx' package was not installed in a way that PackageLoader understands.
Not sure if here jinja2 needs to support more ways to get the template rooot, or pytest loader is missing some methods.
Currently, jinja2 expects either _path defined or get_filenames: https://github.com/pallets/jinja/blob/master/src/jinja2/loaders.py#L262-L281
The pytest assertion rewriter defines neither (see https://github.com/pytest-dev/pytest/blob/master/src/_pytest/assertion/rewrite.py#L48), and as such running a test suite on a source code that has the following global:
will fail with:
Not sure if here jinja2 needs to support more ways to get the template rooot, or pytest loader is missing some methods.