Skip to content
Myr

conftest.py

This file

Path

tests/conftest.py

60 lines · 1.4 KiB · Python

Last changed by

Additional test coverage for async rendering of native type templates (#1807)James Addisonbefore adoptionf8323cf

History of this file

Take it

The walk stopped after 200 commits: lines older than c580dd0 point at it.

Additional test coverage for async rendering of native type templates (#1807)James Addisonbefore adoptionf8323cf

line 1why, one step back
1import asyncio

Merge branch '3.0.x'David Lordbefore adoptioncdbda09

line 2why, one step back
2from pathlib import Path

update building docs instructions in contributing guide (#1235)sixtyfathomsbefore adoptionc580dd0

lines 3–4why, one step back
3
4import pytest

Additional test coverage for async rendering of native type templates (#1807)James Addisonbefore adoptionf8323cf

line 5why, one step back
5import trio

update building docs instructions in contributing guide (#1235)sixtyfathomsbefore adoptionc580dd0

lines 6–7why, one step back
6
7from jinja2 import loaders

Merge pull request #1392 from pallets/inline-asyncDavid Lordbefore adoption9d4689b

line 8why, one step back
8from jinja2.environment import Environment

Additional test coverage for async rendering of native type templates (#1807)James Addisonbefore adoptionf8323cf

lines 9–17why, one step back
9
1011def _asyncio_run(async_fn, *args):12 return asyncio.run(async_fn(*args))131415@pytest.fixture(params=[_asyncio_run, trio.run], ids=["asyncio", "trio"])16def run_async_fn(request):17 return request.param

update building docs instructions in contributing guide (#1235)sixtyfathomsbefore adoptionc580dd0

lines 18–40why, one step back
18
1920@pytest.fixture21def env():22 """returns a new environment."""23 return Environment()242526@pytest.fixture27def dict_loader():28 """returns DictLoader"""29 return loaders.DictLoader({"justdict.html": "FOO"})303132@pytest.fixture33def package_loader():34 """returns PackageLoader initialized from templates"""35 return loaders.PackageLoader("res", "templates")363738@pytest.fixture39def filesystem_loader():40 """returns FileSystemLoader initialized to res/templates directory"""

Merge branch '3.0.x'David Lordbefore adoptioncdbda09

lines 41–42why, one step back
41 here = Path(__file__).parent.resolve()
42 return loaders.FileSystemLoader(here / "res" / "templates")

update building docs instructions in contributing guide (#1235)sixtyfathomsbefore adoptionc580dd0

lines 43–60why, one step back
43
4445@pytest.fixture46def function_loader():47 """returns a FunctionLoader"""48 return loaders.FunctionLoader({"justfunction.html": "FOO"}.get)495051@pytest.fixture52def choice_loader(dict_loader, package_loader):53 """returns a ChoiceLoader"""54 return loaders.ChoiceLoader([dict_loader, package_loader])555657@pytest.fixture58def prefix_loader(filesystem_loader, dict_loader):59 """returns a PrefixLoader"""60 return loaders.PrefixLoader({"a": filesystem_loader, "b": dict_loader})