forked from cwacek/python-jsonschema-objects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
27 lines (20 loc) · 838 Bytes
/
conftest.py
File metadata and controls
27 lines (20 loc) · 838 Bytes
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
import pytest
import json
import pkg_resources
import os
import python_jsonschema_objects as pjs
import python_jsonschema_objects.markdown_support
@pytest.fixture
def markdown_examples():
md = pkg_resources.resource_filename('python_jsonschema_objects.examples', 'README.md')
examples = python_jsonschema_objects.markdown_support.extract_code_blocks(md)
examples = {json.loads(v)['title']: json.loads(v) for v in examples['schema']}
return examples
@pytest.fixture(autouse=True)
def inject_examples(doctest_namespace, markdown_examples):
doctest_namespace['examples'] = markdown_examples
@pytest.fixture
def Person(markdown_examples):
builder = pjs.ObjectBuilder(markdown_examples['Example Schema'], resolved=markdown_examples)
assert builder
return builder.classes['ExampleSchema']