1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
"""
Some fixture methods
"""
import os
import pytest
from crispy_forms.helper import FormHelper
from tests.utils import get_rendered_template, render_attempted_output
@pytest.fixture(scope="session")
def output_test_path(pytestconfig):
"""
Return absolute path to test outputs directory
"""
return os.path.join(pytestconfig.rootdir.strpath, "tests", "output")
@pytest.fixture(scope="session")
def rendered_template():
"""
Return callable function to render form template
"""
return get_rendered_template
@pytest.fixture(scope="session")
def render_output():
"""
Return callable function to render output template
"""
return render_attempted_output
@pytest.fixture(scope="function", params=[
"foundation-6"
])
def helper(request):
"""
Parametrized fixture to return helper configured for a template pack
"""
helper = FormHelper()
helper.template_pack = request.param
return helper
|