Skip to content

Commit

Permalink
fix: Compatibility with hypothesis>=6.49
Browse files Browse the repository at this point in the history
Ref: #1538
  • Loading branch information
Stranger6667 committed Jul 9, 2022
1 parent a44156c commit a1809ac
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 8 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,35 @@ jobs:
uses: codecov/codecov-action@v3.0.0
with:
file: ./coverage.xml

hypothesis-6-48:
strategy:
matrix:
os: [ubuntu-20.04]
tox_job:
- py3-hypothesis-6-48

name: ${{ matrix.os }}/tests_${{ matrix.tox_job }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3.0.0
with:
fetch-depth: 1

- uses: actions/setup-python@v3.1.0
with:
python-version: 3.8

- run: pip install tox coverage poetry

- name: Run ${{ matrix.tox_job }} tox job
run: tox -e ${{ matrix.tox_job }}

- run: coverage combine
- run: coverage report
- run: coverage xml -i

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.0.0
with:
file: ./coverage.xml
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Changelog

- Report uploading to Schemathesis.io via the ``--report`` CLI option.

**Fixed**

- Compatibility with ``hypothesis>=6.49``. `#1538`_

**Removed**

- Previously, data was uploaded to Schemathesis.io when the proper credentials were specified. This release removes this behavior.
Expand Down Expand Up @@ -2955,6 +2959,7 @@ Deprecated
.. _0.3.0: https://github.com/schemathesis/schemathesis/compare/v0.2.0...v0.3.0
.. _0.2.0: https://github.com/schemathesis/schemathesis/compare/v0.1.0...v0.2.0

.. _#1538: https://github.com/schemathesis/schemathesis/issues/1538
.. _#1526: https://github.com/schemathesis/schemathesis/issues/1526
.. _#1518: https://github.com/schemathesis/schemathesis/issues/1518
.. _#1514: https://github.com/schemathesis/schemathesis/issues/1514
Expand Down
20 changes: 15 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/schemathesis/_compat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# pylint: disable=ungrouped-imports
import hypothesis
import hypothesis_jsonschema._from_schema
import jsonschema
import werkzeug
Expand Down Expand Up @@ -26,6 +27,11 @@ class JSONMixin: # type: ignore
except ImportError:
InferType = type(...)

if version.parse(hypothesis.__version__) >= version.parse("6.49"):
from hypothesis.internal.reflection import get_signature
else:
from inspect import getfullargspec as get_signature


def _get_format_filter(
format_name: str,
Expand Down
6 changes: 3 additions & 3 deletions src/schemathesis/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from requests.utils import check_header_validity # type: ignore
from werkzeug.wrappers import Response as BaseResponse

from ._compat import InferType, JSONMixin
from ._compat import InferType, JSONMixin, get_signature
from .constants import USER_AGENT, DataGenerationMethod
from .exceptions import UsageError
from .types import DataGenerationMethodInput, Filter, GenericTest, NotSet, RawAuth
Expand Down Expand Up @@ -442,8 +442,8 @@ def merge_given_args(func: GenericTest, args: Tuple, kwargs: Dict[str, Any]) ->


def validate_given_args(func: GenericTest, args: Tuple, kwargs: Dict[str, Any]) -> Optional[Callable]:
argspec = getfullargspec(func)
return is_invalid_test(func, argspec, args, kwargs) # type: ignore
signature = get_signature(func)
return is_invalid_test(func, signature, args, kwargs) # type: ignore


def compose(*functions: Callable) -> Callable:
Expand Down
7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ envlist =
py{36,37,38,39,310},
py3-pytest53,
py3-pytest6,
py3-hypothesis-6-48,
coverage-report

[testenv]
Expand All @@ -26,6 +27,12 @@ commands =
poetry run pip install "pytest<7" "pytest-subtests<0.7.0"
coverage run --source=schemathesis -m pytest {posargs:} test

[testenv:py3-hypothesis-6-48]
commands =
poetry install -v
poetry run pip install "hypothesis<6.48"
coverage run --source=schemathesis -m pytest {posargs:} test

[testenv:coverage-report]
description = Report coverage over all measured test runs.
basepython = python3.7
Expand Down

0 comments on commit a1809ac

Please sign in to comment.