File: conftest.py

package info (click to toggle)
python-django-crispy-forms-foundation 1.1.0%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 880 kB
  • sloc: javascript: 6,437; python: 1,326; makefile: 200; sh: 17
file content (46 lines) | stat: -rw-r--r-- 967 bytes parent folder | download | duplicates (3)
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