File: conftest.py

package info (click to toggle)
apispec 6.8.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 652 kB
  • sloc: python: 4,852; makefile: 150; sh: 10
file content (35 lines) | stat: -rw-r--r-- 810 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
from collections import namedtuple

import pytest

from apispec import APISpec
from apispec.ext.marshmallow import MarshmallowPlugin


def make_spec(openapi_version):
    ma_plugin = MarshmallowPlugin()
    spec = APISpec(
        title="Validation",
        version="0.1",
        openapi_version=openapi_version,
        plugins=(ma_plugin,),
    )
    return namedtuple("Spec", ("spec", "marshmallow_plugin", "openapi"))(
        spec, ma_plugin, ma_plugin.converter
    )


@pytest.fixture(params=("2.0", "3.0.0"))
def spec_fixture(request):
    return make_spec(request.param)


@pytest.fixture(params=("2.0", "3.0.0"))
def spec(request):
    return make_spec(request.param).spec


@pytest.fixture(params=("2.0", "3.0.0"))
def openapi(request):
    spec = make_spec(request.param)
    return spec.openapi