File: conftest.py

package info (click to toggle)
swagger-spec-validator 3.0.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 696 kB
  • sloc: python: 2,321; makefile: 28; sh: 2
file content (24 lines) | stat: -rw-r--r-- 564 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
import json
import os

import pytest

from swagger_spec_validator.common import get_uri_from_file_path
from tests import TESTS_BASE_PATH


@pytest.fixture(scope="session")
def petstore_contents():
    with open(TESTS_BASE_PATH + "/data/v2.0/petstore.json") as f:
        return f.read()


@pytest.fixture
def petstore_dict(petstore_contents):
    return json.loads(petstore_contents)


def get_spec_json_and_url(rel_path):
    abs_path = os.path.abspath(rel_path)
    with open(abs_path) as f:
        return json.loads(f.read()), get_uri_from_file_path(abs_path)