Skip to content

Commit

Permalink
Restructure & remove duplicate tests & rename readers -> loaders
Browse files Browse the repository at this point in the history
  • Loading branch information
Stranger6667 authored and svtkachenko committed Sep 18, 2019
1 parent 9349121 commit e430ef7
Show file tree
Hide file tree
Showing 30 changed files with 831 additions and 851 deletions.
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Changelog
`Unreleased`_
-------------

Changed
~~~~~~~

- Rename module `readers` to `loaders`.

`0.5.0`_ - 2019-09-16
---------------------

Expand Down
2 changes: 1 addition & 1 deletion src/schemathesis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .loaders import Parametrizer, from_dict, from_file, from_path, from_uri
from .models import Case
from .readers import Parametrizer, from_dict, from_file, from_path, from_uri
File renamed without changes.
52 changes: 50 additions & 2 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from textwrap import dedent

import pytest

from schemathesis import Case
import schemathesis

from .utils import make_schema

pytest_plugins = ["pytester"]

Expand All @@ -26,12 +30,56 @@ def simple_schema():
}


@pytest.fixture()
def swagger_20(simple_schema):
return schemathesis.from_dict(simple_schema)


@pytest.fixture()
def case_factory():

defaults = {"method": "GET", "headers": {}, "query": [], "body": {}}

def maker(**kwargs):
return Case(**{**defaults, **kwargs})
return schemathesis.Case(**{**defaults, **kwargs})

return maker


@pytest.fixture()
def testdir(testdir):
def maker(content, **kwargs):
schema = make_schema(**kwargs)
preparation = dedent(
"""
import pytest
import schemathesis
from test.utils import *
from hypothesis import settings
raw_schema = {schema}
schema = schemathesis.from_dict(raw_schema)
""".format(
schema=schema
)
)
testdir.makepyfile(preparation, content)
testdir.makepyfile(
conftest=dedent(
"""
def pytest_configure(config):
config.HYPOTHESIS_CASES = 0
def pytest_unconfigure(config):
print(f"Hypothesis calls: {config.HYPOTHESIS_CASES}")
"""
)
)

testdir.make_test = maker

def run_and_assert(*args, **kwargs):
result = testdir.runpytest(*args)
result.assert_outcomes(**kwargs)

testdir.run_and_assert = run_and_assert

return testdir
File renamed without changes.
File renamed without changes.
File renamed without changes.
44 changes: 0 additions & 44 deletions test/schemas/conftest.py

This file was deleted.

16 changes: 0 additions & 16 deletions test/schemas/test_body.py

This file was deleted.

61 changes: 0 additions & 61 deletions test/schemas/test_dereferencing.py

This file was deleted.

16 changes: 0 additions & 16 deletions test/schemas/test_header.py

This file was deleted.

0 comments on commit e430ef7

Please sign in to comment.