schemathesis 3.15.4__py3-none-any.whl → 4.4.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- schemathesis/__init__.py +53 -25
- schemathesis/auths.py +507 -0
- schemathesis/checks.py +190 -25
- schemathesis/cli/__init__.py +27 -1219
- schemathesis/cli/__main__.py +4 -0
- schemathesis/cli/commands/__init__.py +133 -0
- schemathesis/cli/commands/data.py +10 -0
- schemathesis/cli/commands/run/__init__.py +602 -0
- schemathesis/cli/commands/run/context.py +228 -0
- schemathesis/cli/commands/run/events.py +60 -0
- schemathesis/cli/commands/run/executor.py +157 -0
- schemathesis/cli/commands/run/filters.py +53 -0
- schemathesis/cli/commands/run/handlers/__init__.py +46 -0
- schemathesis/cli/commands/run/handlers/base.py +45 -0
- schemathesis/cli/commands/run/handlers/cassettes.py +464 -0
- schemathesis/cli/commands/run/handlers/junitxml.py +60 -0
- schemathesis/cli/commands/run/handlers/output.py +1750 -0
- schemathesis/cli/commands/run/loaders.py +118 -0
- schemathesis/cli/commands/run/validation.py +256 -0
- schemathesis/cli/constants.py +5 -0
- schemathesis/cli/core.py +19 -0
- schemathesis/cli/ext/fs.py +16 -0
- schemathesis/cli/ext/groups.py +203 -0
- schemathesis/cli/ext/options.py +81 -0
- schemathesis/config/__init__.py +202 -0
- schemathesis/config/_auth.py +51 -0
- schemathesis/config/_checks.py +268 -0
- schemathesis/config/_diff_base.py +101 -0
- schemathesis/config/_env.py +21 -0
- schemathesis/config/_error.py +163 -0
- schemathesis/config/_generation.py +157 -0
- schemathesis/config/_health_check.py +24 -0
- schemathesis/config/_operations.py +335 -0
- schemathesis/config/_output.py +171 -0
- schemathesis/config/_parameters.py +19 -0
- schemathesis/config/_phases.py +253 -0
- schemathesis/config/_projects.py +543 -0
- schemathesis/config/_rate_limit.py +17 -0
- schemathesis/config/_report.py +120 -0
- schemathesis/config/_validator.py +9 -0
- schemathesis/config/_warnings.py +89 -0
- schemathesis/config/schema.json +975 -0
- schemathesis/core/__init__.py +72 -0
- schemathesis/core/adapter.py +34 -0
- schemathesis/core/compat.py +32 -0
- schemathesis/core/control.py +2 -0
- schemathesis/core/curl.py +100 -0
- schemathesis/core/deserialization.py +210 -0
- schemathesis/core/errors.py +588 -0
- schemathesis/core/failures.py +316 -0
- schemathesis/core/fs.py +19 -0
- schemathesis/core/hooks.py +20 -0
- schemathesis/core/jsonschema/__init__.py +13 -0
- schemathesis/core/jsonschema/bundler.py +183 -0
- schemathesis/core/jsonschema/keywords.py +40 -0
- schemathesis/core/jsonschema/references.py +222 -0
- schemathesis/core/jsonschema/types.py +41 -0
- schemathesis/core/lazy_import.py +15 -0
- schemathesis/core/loaders.py +107 -0
- schemathesis/core/marks.py +66 -0
- schemathesis/core/media_types.py +79 -0
- schemathesis/core/output/__init__.py +46 -0
- schemathesis/core/output/sanitization.py +54 -0
- schemathesis/core/parameters.py +45 -0
- schemathesis/core/rate_limit.py +60 -0
- schemathesis/core/registries.py +34 -0
- schemathesis/core/result.py +27 -0
- schemathesis/core/schema_analysis.py +17 -0
- schemathesis/core/shell.py +203 -0
- schemathesis/core/transforms.py +144 -0
- schemathesis/core/transport.py +223 -0
- schemathesis/core/validation.py +73 -0
- schemathesis/core/version.py +7 -0
- schemathesis/engine/__init__.py +28 -0
- schemathesis/engine/context.py +152 -0
- schemathesis/engine/control.py +44 -0
- schemathesis/engine/core.py +201 -0
- schemathesis/engine/errors.py +446 -0
- schemathesis/engine/events.py +284 -0
- schemathesis/engine/observations.py +42 -0
- schemathesis/engine/phases/__init__.py +108 -0
- schemathesis/engine/phases/analysis.py +28 -0
- schemathesis/engine/phases/probes.py +172 -0
- schemathesis/engine/phases/stateful/__init__.py +68 -0
- schemathesis/engine/phases/stateful/_executor.py +364 -0
- schemathesis/engine/phases/stateful/context.py +85 -0
- schemathesis/engine/phases/unit/__init__.py +220 -0
- schemathesis/engine/phases/unit/_executor.py +459 -0
- schemathesis/engine/phases/unit/_pool.py +82 -0
- schemathesis/engine/recorder.py +254 -0
- schemathesis/errors.py +47 -0
- schemathesis/filters.py +395 -0
- schemathesis/generation/__init__.py +25 -0
- schemathesis/generation/case.py +478 -0
- schemathesis/generation/coverage.py +1528 -0
- schemathesis/generation/hypothesis/__init__.py +121 -0
- schemathesis/generation/hypothesis/builder.py +992 -0
- schemathesis/generation/hypothesis/examples.py +56 -0
- schemathesis/generation/hypothesis/given.py +66 -0
- schemathesis/generation/hypothesis/reporting.py +285 -0
- schemathesis/generation/meta.py +227 -0
- schemathesis/generation/metrics.py +93 -0
- schemathesis/generation/modes.py +20 -0
- schemathesis/generation/overrides.py +127 -0
- schemathesis/generation/stateful/__init__.py +37 -0
- schemathesis/generation/stateful/state_machine.py +294 -0
- schemathesis/graphql/__init__.py +15 -0
- schemathesis/graphql/checks.py +109 -0
- schemathesis/graphql/loaders.py +285 -0
- schemathesis/hooks.py +270 -91
- schemathesis/openapi/__init__.py +13 -0
- schemathesis/openapi/checks.py +467 -0
- schemathesis/openapi/generation/__init__.py +0 -0
- schemathesis/openapi/generation/filters.py +72 -0
- schemathesis/openapi/loaders.py +315 -0
- schemathesis/pytest/__init__.py +5 -0
- schemathesis/pytest/control_flow.py +7 -0
- schemathesis/pytest/lazy.py +341 -0
- schemathesis/pytest/loaders.py +36 -0
- schemathesis/pytest/plugin.py +357 -0
- schemathesis/python/__init__.py +0 -0
- schemathesis/python/asgi.py +12 -0
- schemathesis/python/wsgi.py +12 -0
- schemathesis/schemas.py +682 -257
- schemathesis/specs/graphql/__init__.py +0 -1
- schemathesis/specs/graphql/nodes.py +26 -2
- schemathesis/specs/graphql/scalars.py +77 -12
- schemathesis/specs/graphql/schemas.py +367 -148
- schemathesis/specs/graphql/validation.py +33 -0
- schemathesis/specs/openapi/__init__.py +9 -1
- schemathesis/specs/openapi/_hypothesis.py +555 -318
- schemathesis/specs/openapi/adapter/__init__.py +10 -0
- schemathesis/specs/openapi/adapter/parameters.py +729 -0
- schemathesis/specs/openapi/adapter/protocol.py +59 -0
- schemathesis/specs/openapi/adapter/references.py +19 -0
- schemathesis/specs/openapi/adapter/responses.py +368 -0
- schemathesis/specs/openapi/adapter/security.py +144 -0
- schemathesis/specs/openapi/adapter/v2.py +30 -0
- schemathesis/specs/openapi/adapter/v3_0.py +30 -0
- schemathesis/specs/openapi/adapter/v3_1.py +30 -0
- schemathesis/specs/openapi/analysis.py +96 -0
- schemathesis/specs/openapi/checks.py +748 -82
- schemathesis/specs/openapi/converter.py +176 -37
- schemathesis/specs/openapi/definitions.py +599 -4
- schemathesis/specs/openapi/examples.py +581 -165
- schemathesis/specs/openapi/expressions/__init__.py +52 -5
- schemathesis/specs/openapi/expressions/extractors.py +25 -0
- schemathesis/specs/openapi/expressions/lexer.py +34 -31
- schemathesis/specs/openapi/expressions/nodes.py +97 -46
- schemathesis/specs/openapi/expressions/parser.py +35 -13
- schemathesis/specs/openapi/formats.py +122 -0
- schemathesis/specs/openapi/media_types.py +75 -0
- schemathesis/specs/openapi/negative/__init__.py +93 -73
- schemathesis/specs/openapi/negative/mutations.py +294 -103
- schemathesis/specs/openapi/negative/utils.py +0 -9
- schemathesis/specs/openapi/patterns.py +458 -0
- schemathesis/specs/openapi/references.py +60 -81
- schemathesis/specs/openapi/schemas.py +647 -666
- schemathesis/specs/openapi/serialization.py +53 -30
- schemathesis/specs/openapi/stateful/__init__.py +403 -68
- schemathesis/specs/openapi/stateful/control.py +87 -0
- schemathesis/specs/openapi/stateful/dependencies/__init__.py +232 -0
- schemathesis/specs/openapi/stateful/dependencies/inputs.py +428 -0
- schemathesis/specs/openapi/stateful/dependencies/models.py +341 -0
- schemathesis/specs/openapi/stateful/dependencies/naming.py +491 -0
- schemathesis/specs/openapi/stateful/dependencies/outputs.py +34 -0
- schemathesis/specs/openapi/stateful/dependencies/resources.py +339 -0
- schemathesis/specs/openapi/stateful/dependencies/schemas.py +447 -0
- schemathesis/specs/openapi/stateful/inference.py +254 -0
- schemathesis/specs/openapi/stateful/links.py +219 -78
- schemathesis/specs/openapi/types/__init__.py +3 -0
- schemathesis/specs/openapi/types/common.py +23 -0
- schemathesis/specs/openapi/types/v2.py +129 -0
- schemathesis/specs/openapi/types/v3.py +134 -0
- schemathesis/specs/openapi/utils.py +7 -6
- schemathesis/specs/openapi/warnings.py +75 -0
- schemathesis/transport/__init__.py +224 -0
- schemathesis/transport/asgi.py +26 -0
- schemathesis/transport/prepare.py +126 -0
- schemathesis/transport/requests.py +278 -0
- schemathesis/transport/serialization.py +329 -0
- schemathesis/transport/wsgi.py +175 -0
- schemathesis-4.4.2.dist-info/METADATA +213 -0
- schemathesis-4.4.2.dist-info/RECORD +192 -0
- {schemathesis-3.15.4.dist-info → schemathesis-4.4.2.dist-info}/WHEEL +1 -1
- schemathesis-4.4.2.dist-info/entry_points.txt +6 -0
- {schemathesis-3.15.4.dist-info → schemathesis-4.4.2.dist-info/licenses}/LICENSE +1 -1
- schemathesis/_compat.py +0 -57
- schemathesis/_hypothesis.py +0 -123
- schemathesis/auth.py +0 -214
- schemathesis/cli/callbacks.py +0 -240
- schemathesis/cli/cassettes.py +0 -351
- schemathesis/cli/context.py +0 -38
- schemathesis/cli/debug.py +0 -21
- schemathesis/cli/handlers.py +0 -11
- schemathesis/cli/junitxml.py +0 -41
- schemathesis/cli/options.py +0 -70
- schemathesis/cli/output/__init__.py +0 -1
- schemathesis/cli/output/default.py +0 -521
- schemathesis/cli/output/short.py +0 -40
- schemathesis/constants.py +0 -88
- schemathesis/exceptions.py +0 -257
- schemathesis/extra/_aiohttp.py +0 -27
- schemathesis/extra/_flask.py +0 -10
- schemathesis/extra/_server.py +0 -16
- schemathesis/extra/pytest_plugin.py +0 -251
- schemathesis/failures.py +0 -145
- schemathesis/fixups/__init__.py +0 -29
- schemathesis/fixups/fast_api.py +0 -30
- schemathesis/graphql.py +0 -5
- schemathesis/internal.py +0 -6
- schemathesis/lazy.py +0 -301
- schemathesis/models.py +0 -1113
- schemathesis/parameters.py +0 -91
- schemathesis/runner/__init__.py +0 -470
- schemathesis/runner/events.py +0 -242
- schemathesis/runner/impl/__init__.py +0 -3
- schemathesis/runner/impl/core.py +0 -791
- schemathesis/runner/impl/solo.py +0 -85
- schemathesis/runner/impl/threadpool.py +0 -367
- schemathesis/runner/serialization.py +0 -206
- schemathesis/serializers.py +0 -253
- schemathesis/service/__init__.py +0 -18
- schemathesis/service/auth.py +0 -10
- schemathesis/service/client.py +0 -62
- schemathesis/service/constants.py +0 -25
- schemathesis/service/events.py +0 -39
- schemathesis/service/handler.py +0 -46
- schemathesis/service/hosts.py +0 -74
- schemathesis/service/metadata.py +0 -42
- schemathesis/service/models.py +0 -21
- schemathesis/service/serialization.py +0 -184
- schemathesis/service/worker.py +0 -39
- schemathesis/specs/graphql/loaders.py +0 -215
- schemathesis/specs/openapi/constants.py +0 -7
- schemathesis/specs/openapi/expressions/context.py +0 -12
- schemathesis/specs/openapi/expressions/pointers.py +0 -29
- schemathesis/specs/openapi/filters.py +0 -44
- schemathesis/specs/openapi/links.py +0 -303
- schemathesis/specs/openapi/loaders.py +0 -453
- schemathesis/specs/openapi/parameters.py +0 -430
- schemathesis/specs/openapi/security.py +0 -129
- schemathesis/specs/openapi/validation.py +0 -24
- schemathesis/stateful.py +0 -358
- schemathesis/targets.py +0 -32
- schemathesis/types.py +0 -38
- schemathesis/utils.py +0 -475
- schemathesis-3.15.4.dist-info/METADATA +0 -202
- schemathesis-3.15.4.dist-info/RECORD +0 -99
- schemathesis-3.15.4.dist-info/entry_points.txt +0 -7
- /schemathesis/{extra → cli/ext}/__init__.py +0 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: schemathesis
|
|
3
|
+
Version: 4.4.2
|
|
4
|
+
Summary: Property-based testing framework for Open API and GraphQL based apps
|
|
5
|
+
Project-URL: Documentation, https://schemathesis.readthedocs.io/en/stable/
|
|
6
|
+
Project-URL: Changelog, https://github.com/schemathesis/schemathesis/blob/master/CHANGELOG.md
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/schemathesis/schemathesis
|
|
8
|
+
Project-URL: Funding, https://github.com/sponsors/Stranger6667
|
|
9
|
+
Project-URL: Source Code, https://github.com/schemathesis/schemathesis
|
|
10
|
+
Author-email: Dmitry Dygalo <dmitry@dygalo.dev>
|
|
11
|
+
Maintainer-email: Dmitry Dygalo <dmitry@dygalo.dev>
|
|
12
|
+
License-Expression: MIT
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Keywords: graphql,hypothesis,openapi,pytest,testing
|
|
15
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
16
|
+
Classifier: Environment :: Console
|
|
17
|
+
Classifier: Framework :: Hypothesis
|
|
18
|
+
Classifier: Framework :: Pytest
|
|
19
|
+
Classifier: Intended Audience :: Developers
|
|
20
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
29
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
30
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
31
|
+
Classifier: Topic :: Software Development :: Testing
|
|
32
|
+
Requires-Python: >=3.9
|
|
33
|
+
Requires-Dist: backoff<3.0,>=2.1.2
|
|
34
|
+
Requires-Dist: click<9,>=8.0
|
|
35
|
+
Requires-Dist: colorama<1.0,>=0.4
|
|
36
|
+
Requires-Dist: harfile<1.0,>=0.4.0
|
|
37
|
+
Requires-Dist: httpx<1.0,>=0.22.0
|
|
38
|
+
Requires-Dist: hypothesis-graphql<1,>=0.11.1
|
|
39
|
+
Requires-Dist: hypothesis-jsonschema<0.24,>=0.23.1
|
|
40
|
+
Requires-Dist: hypothesis<7,>=6.108.0
|
|
41
|
+
Requires-Dist: jsonschema[format]<5.0,>=4.18.0
|
|
42
|
+
Requires-Dist: junit-xml<2.0,>=1.9
|
|
43
|
+
Requires-Dist: pyrate-limiter<4.0,>=3.0
|
|
44
|
+
Requires-Dist: pytest-subtests<0.15.0,>=0.11
|
|
45
|
+
Requires-Dist: pytest<9,>=8
|
|
46
|
+
Requires-Dist: pyyaml<7.0,>=5.1
|
|
47
|
+
Requires-Dist: requests<3,>=2.22
|
|
48
|
+
Requires-Dist: rich>=13.9.4
|
|
49
|
+
Requires-Dist: starlette-testclient<1,>=0.4.1
|
|
50
|
+
Requires-Dist: tomli>=2.2.1; python_version < '3.11'
|
|
51
|
+
Requires-Dist: typing-extensions>=4.12.2
|
|
52
|
+
Requires-Dist: werkzeug<4,>=0.16.0
|
|
53
|
+
Provides-Extra: bench
|
|
54
|
+
Requires-Dist: pytest-codspeed==4.2.0; extra == 'bench'
|
|
55
|
+
Provides-Extra: cov
|
|
56
|
+
Requires-Dist: coverage-enable-subprocess; extra == 'cov'
|
|
57
|
+
Requires-Dist: coverage[toml]>=5.3; extra == 'cov'
|
|
58
|
+
Provides-Extra: dev
|
|
59
|
+
Requires-Dist: aiohttp<4.0,>=3.9.1; extra == 'dev'
|
|
60
|
+
Requires-Dist: coverage-enable-subprocess; extra == 'dev'
|
|
61
|
+
Requires-Dist: coverage>=6; extra == 'dev'
|
|
62
|
+
Requires-Dist: coverage[toml]>=5.3; extra == 'dev'
|
|
63
|
+
Requires-Dist: fastapi>=0.86.0; extra == 'dev'
|
|
64
|
+
Requires-Dist: flask<3.0,>=2.1.1; extra == 'dev'
|
|
65
|
+
Requires-Dist: hypothesis-openapi<1,>=0.2; (python_version >= '3.10') and extra == 'dev'
|
|
66
|
+
Requires-Dist: mkdocs-material; extra == 'dev'
|
|
67
|
+
Requires-Dist: mkdocstrings[python]; extra == 'dev'
|
|
68
|
+
Requires-Dist: pydantic>=1.10.2; extra == 'dev'
|
|
69
|
+
Requires-Dist: pytest-asyncio<2.0,>=1.0; extra == 'dev'
|
|
70
|
+
Requires-Dist: pytest-codspeed==4.2.0; extra == 'dev'
|
|
71
|
+
Requires-Dist: pytest-httpserver<2.0,>=1.0; extra == 'dev'
|
|
72
|
+
Requires-Dist: pytest-mock<4.0,>=3.7.0; extra == 'dev'
|
|
73
|
+
Requires-Dist: pytest-trio<1.0,>=0.8; extra == 'dev'
|
|
74
|
+
Requires-Dist: pytest-xdist<4.0,>=3; extra == 'dev'
|
|
75
|
+
Requires-Dist: strawberry-graphql[fastapi]>=0.109.0; extra == 'dev'
|
|
76
|
+
Requires-Dist: syrupy<5.0,>=2; extra == 'dev'
|
|
77
|
+
Requires-Dist: tomli-w>=1.2.0; extra == 'dev'
|
|
78
|
+
Requires-Dist: trustme<1.0,>=0.9.0; extra == 'dev'
|
|
79
|
+
Provides-Extra: docs
|
|
80
|
+
Requires-Dist: mkdocs-material; extra == 'docs'
|
|
81
|
+
Requires-Dist: mkdocstrings[python]; extra == 'docs'
|
|
82
|
+
Provides-Extra: tests
|
|
83
|
+
Requires-Dist: aiohttp<4.0,>=3.9.1; extra == 'tests'
|
|
84
|
+
Requires-Dist: coverage>=6; extra == 'tests'
|
|
85
|
+
Requires-Dist: fastapi>=0.86.0; extra == 'tests'
|
|
86
|
+
Requires-Dist: flask<3.0,>=2.1.1; extra == 'tests'
|
|
87
|
+
Requires-Dist: hypothesis-openapi<1,>=0.2; (python_version >= '3.10') and extra == 'tests'
|
|
88
|
+
Requires-Dist: pydantic>=1.10.2; extra == 'tests'
|
|
89
|
+
Requires-Dist: pytest-asyncio<2.0,>=1.0; extra == 'tests'
|
|
90
|
+
Requires-Dist: pytest-httpserver<2.0,>=1.0; extra == 'tests'
|
|
91
|
+
Requires-Dist: pytest-mock<4.0,>=3.7.0; extra == 'tests'
|
|
92
|
+
Requires-Dist: pytest-trio<1.0,>=0.8; extra == 'tests'
|
|
93
|
+
Requires-Dist: pytest-xdist<4.0,>=3; extra == 'tests'
|
|
94
|
+
Requires-Dist: strawberry-graphql[fastapi]>=0.109.0; extra == 'tests'
|
|
95
|
+
Requires-Dist: syrupy<5.0,>=2; extra == 'tests'
|
|
96
|
+
Requires-Dist: tomli-w>=1.2.0; extra == 'tests'
|
|
97
|
+
Requires-Dist: trustme<1.0,>=0.9.0; extra == 'tests'
|
|
98
|
+
Description-Content-Type: text/markdown
|
|
99
|
+
|
|
100
|
+
<p align="center">
|
|
101
|
+
<a href="https://github.com/schemathesis/schemathesis/actions" target="_blank">
|
|
102
|
+
<img src="https://github.com/schemathesis/schemathesis/actions/workflows/build.yml/badge.svg" alt="Build">
|
|
103
|
+
</a>
|
|
104
|
+
<a href="https://codecov.io/gh/schemathesis/schemathesis/branch/master" target="_blank">
|
|
105
|
+
<img src="https://codecov.io/gh/schemathesis/schemathesis/branch/master/graph/badge.svg" alt="Coverage">
|
|
106
|
+
</a>
|
|
107
|
+
<a href="https://pypi.org/project/schemathesis/" target="_blank">
|
|
108
|
+
<img src="https://img.shields.io/pypi/v/schemathesis.svg" alt="Version">
|
|
109
|
+
</a>
|
|
110
|
+
<a href="https://pypi.org/project/schemathesis/" target="_blank">
|
|
111
|
+
<img src="https://img.shields.io/pypi/pyversions/schemathesis.svg" alt="Python versions">
|
|
112
|
+
</a>
|
|
113
|
+
<a href="https://discord.gg/R9ASRAmHnA" target="_blank">
|
|
114
|
+
<img src="https://img.shields.io/discord/938139740912369755" alt="Discord">
|
|
115
|
+
</a>
|
|
116
|
+
<a href="https://opensource.org/licenses/MIT" target="_blank">
|
|
117
|
+
<img src="https://img.shields.io/pypi/l/schemathesis.svg" alt="License">
|
|
118
|
+
</a>
|
|
119
|
+
</p>
|
|
120
|
+
|
|
121
|
+
## Schemathesis
|
|
122
|
+
|
|
123
|
+
> **Catch API bugs before your users do.**
|
|
124
|
+
|
|
125
|
+
Schemathesis automatically generates thousands of test cases from your OpenAPI or GraphQL schema and finds edge cases that break your API.
|
|
126
|
+
|
|
127
|
+
<p align="center">
|
|
128
|
+
<img src="https://raw.githubusercontent.com/schemathesis/schemathesis/master/img/demo.gif" alt="Schemathesis automatically finding a server error"/>
|
|
129
|
+
<br>
|
|
130
|
+
<i>Finding bugs that manual testing missed</i>
|
|
131
|
+
</p>
|
|
132
|
+
|
|
133
|
+
## Try it now
|
|
134
|
+
|
|
135
|
+
```console
|
|
136
|
+
# Test a demo API - finds real bugs in 30 seconds
|
|
137
|
+
uvx schemathesis run https://example.schemathesis.io/openapi.json
|
|
138
|
+
|
|
139
|
+
# Test your own API
|
|
140
|
+
uvx schemathesis run https://your-api.com/openapi.json
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
## What problems does it solve?
|
|
145
|
+
|
|
146
|
+
- 💥 **500 errors** that crash your API on edge case inputs
|
|
147
|
+
- 📋 **Schema violations** where your API returns different data than documented
|
|
148
|
+
- 🚪 **Validation bypasses** where invalid data gets accepted
|
|
149
|
+
- 🔗 **Integration failures** when responses don't match client expectations
|
|
150
|
+
- 🔄 **Stateful bugs** where operations work individually but fail in realistic workflows
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
> ⚠️ **Upgrading from older versions?** Check our [Migration Guide](https://github.com/schemathesis/schemathesis/blob/master/MIGRATION.md) for key changes.
|
|
154
|
+
|
|
155
|
+
# Installation & Usage
|
|
156
|
+
|
|
157
|
+
**Command Line:**
|
|
158
|
+
```console
|
|
159
|
+
uv pip install schemathesis
|
|
160
|
+
schemathesis run https://your-api.com/openapi.json
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Python Tests:**
|
|
164
|
+
```python
|
|
165
|
+
import schemathesis
|
|
166
|
+
|
|
167
|
+
schema = schemathesis.openapi.from_url("https://your-api.com/openapi.json")
|
|
168
|
+
|
|
169
|
+
@schema.parametrize()
|
|
170
|
+
def test_api(case):
|
|
171
|
+
# Tests with random data, edge cases, and invalid inputs
|
|
172
|
+
case.call_and_validate()
|
|
173
|
+
|
|
174
|
+
# Stateful testing: Tests workflows like: create user -> get user -> delete user
|
|
175
|
+
APIWorkflow = schema.as_state_machine()
|
|
176
|
+
# Creates a test class for pytest/unittest
|
|
177
|
+
TestAPI = APIWorkflow.TestCase
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**CI/CD:**
|
|
181
|
+
```yaml
|
|
182
|
+
- uses: schemathesis/action@v2
|
|
183
|
+
with:
|
|
184
|
+
schema: "https://your-api.com/openapi.json"
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Who uses it
|
|
188
|
+
|
|
189
|
+
Used by teams at **[Spotify](https://github.com/backstage/backstage)**, **[WordPress](https://github.com/WordPress/openverse)**, **JetBrains**, **Red Hat**, and dozens of other companies.
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
> "_Schemathesis is the best tool for fuzz testing of REST APIs on the market. We at Red Hat use it for examining our applications in functional and integration testing levels._" - Dmitry Misharov, RedHat
|
|
193
|
+
|
|
194
|
+
## Documentation
|
|
195
|
+
|
|
196
|
+
📚 **[Documentation](https://schemathesis.readthedocs.io/en/stable/)** with guides, examples, and API reference.
|
|
197
|
+
|
|
198
|
+
## Get Help
|
|
199
|
+
|
|
200
|
+
- 💬 [Discord community](https://discord.gg/R9ASRAmHnA)
|
|
201
|
+
- 🐛 [GitHub issues](https://github.com/schemathesis/schemathesis/issues)
|
|
202
|
+
|
|
203
|
+
## Contributing
|
|
204
|
+
|
|
205
|
+
We welcome contributions! See our [contributing guidelines](CONTRIBUTING.md) and join discussions in [issues](https://github.com/schemathesis/schemathesis/issues) or [Discord](https://discord.gg/R9ASRAmHnA).
|
|
206
|
+
|
|
207
|
+
## Acknowledgements
|
|
208
|
+
|
|
209
|
+
Schemathesis is built on top of <a href="https://hypothesis.works/" target="_blank">Hypothesis</a>, a powerful property-based testing library for Python.
|
|
210
|
+
|
|
211
|
+
## License
|
|
212
|
+
|
|
213
|
+
This project is licensed under the terms of the [MIT license](https://opensource.org/licenses/MIT).
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
schemathesis/__init__.py,sha256=wr8u9k85xMua6RJX4Qv9xBlK8nGHFFZTYLtdc3OObrc,1587
|
|
2
|
+
schemathesis/auths.py,sha256=UNMX7Fo_9V-JzkOuiANdWWYsbtmWU_yFaPKG0q34T1I,17414
|
|
3
|
+
schemathesis/checks.py,sha256=F_lsC5JTUKm_ByvilBN_9IpbL4mJiidfLgS8ir2ZDoQ,6873
|
|
4
|
+
schemathesis/errors.py,sha256=K3irHIZkrBH2-9LIjlgXlm8RNC41Nffd39ncfwagUvw,1053
|
|
5
|
+
schemathesis/filters.py,sha256=IevPA5A04GfRLLjmkFLZ0CLhjNO3RmpZq_yw6MqjLIA,13515
|
|
6
|
+
schemathesis/hooks.py,sha256=q2wqYNgpMCO8ImSBkbrWDSwN0BSELelqJMgAAgGvv2M,14836
|
|
7
|
+
schemathesis/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
schemathesis/schemas.py,sha256=BBijCKhFZ-eDxoiW0UtRKa9r_rQNqsGs8VikIQecu60,28029
|
|
9
|
+
schemathesis/cli/__init__.py,sha256=U9gjzWWpiFhaqevPjZbwyTNjABdpvXETI4HgwdGKnvs,877
|
|
10
|
+
schemathesis/cli/__main__.py,sha256=MWaenjaUTZIfNPFzKmnkTiawUri7DVldtg3mirLwzU8,92
|
|
11
|
+
schemathesis/cli/constants.py,sha256=CVcQNHEiX-joAQmyuEVKWPOSxDHsOw_EXXZsEclzLuY,341
|
|
12
|
+
schemathesis/cli/core.py,sha256=ue7YUdVo3YvuzGL4s6i62NL6YqNDeVPBSnQ1znrvG2w,480
|
|
13
|
+
schemathesis/cli/commands/__init__.py,sha256=R61W6syrRHfxMz5S9tOODFNOQsK29SKb5jwdixh07jo,4830
|
|
14
|
+
schemathesis/cli/commands/data.py,sha256=_ALywjIeCZjuaoDQFy-Kj8RZkEGqXd-Y95O47h8Jszs,171
|
|
15
|
+
schemathesis/cli/commands/run/__init__.py,sha256=mw5hrtsbtZJOcBpKvrDWvhlh712zsHqpGMlT3ntty3E,19085
|
|
16
|
+
schemathesis/cli/commands/run/context.py,sha256=vej33l5yOhlJ5gLXDwat9WCW_XdhrHNc9pdIQQYddoY,9004
|
|
17
|
+
schemathesis/cli/commands/run/events.py,sha256=ew0TQOc9T2YBZynYWv95k9yfAk8-hGuZDLMxjT8EhvY,1595
|
|
18
|
+
schemathesis/cli/commands/run/executor.py,sha256=_koznTX0DoELPN_1mxr9K_Qg7-9MPXWdld1MFn3YG_Y,5329
|
|
19
|
+
schemathesis/cli/commands/run/filters.py,sha256=RZwW_p8DFvzRZhmpwA9s26GXcviDGk4P4iS6rYT-s8M,1675
|
|
20
|
+
schemathesis/cli/commands/run/loaders.py,sha256=Tc5cnHgIw4kzSQCGRg1Kpz8_m8BDTcTrzS9-l6MDWS8,4506
|
|
21
|
+
schemathesis/cli/commands/run/validation.py,sha256=SDVW31NjTPuYiRd_l-A2oFaGP9II2Gk9ktlKVSWfLek,9177
|
|
22
|
+
schemathesis/cli/commands/run/handlers/__init__.py,sha256=TPZ3KdGi8m0fjlN0GjA31MAXXn1qI7uU4FtiDwroXZI,1915
|
|
23
|
+
schemathesis/cli/commands/run/handlers/base.py,sha256=5stD6-oRKKew-lojl70DbKhCikNnnBgW80aVdC5Tmjk,1284
|
|
24
|
+
schemathesis/cli/commands/run/handlers/cassettes.py,sha256=2sXW9jykEFw4HCv25ycRfRd8uw5VV1e26Cp14O7PVhs,19245
|
|
25
|
+
schemathesis/cli/commands/run/handlers/junitxml.py,sha256=qiFvM4-SlM67sep003SkLqPslzaEb4nOm3bkzw-DO-Q,2602
|
|
26
|
+
schemathesis/cli/commands/run/handlers/output.py,sha256=lUaRAQyBOmRk8z8-DRe_9-Vtv4uWKvJ1kesmljSlJkg,68344
|
|
27
|
+
schemathesis/cli/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
|
+
schemathesis/cli/ext/fs.py,sha256=dHQYBjQozQmuSSfXVp-2KWFK0ESOb_w-lV2SptfMfco,461
|
|
29
|
+
schemathesis/cli/ext/groups.py,sha256=rx19uTkUTCALNqF-P7RN_0NVUFLDoZcHJij1vnBnxR4,7415
|
|
30
|
+
schemathesis/cli/ext/options.py,sha256=LCTrNkP8U-hLH72zZEWk9MJuHvbL7n8tUa3596_0H8g,3271
|
|
31
|
+
schemathesis/config/__init__.py,sha256=yRPtVUWjSTqTPlzjsbDXsgz7wsAaO2JTxjINhj3P0U4,6470
|
|
32
|
+
schemathesis/config/_auth.py,sha256=83RLVPm97W2thbn-yi01Rt94YwOxLG_a5VoxhEfjUjs,1528
|
|
33
|
+
schemathesis/config/_checks.py,sha256=F0r16eSSiICvoiTUkNNOE2PH73EGd8bikoeZdME_3Yw,10763
|
|
34
|
+
schemathesis/config/_diff_base.py,sha256=KaomyZy-paOgWQyKF9ezTNU2_BAHXJeDD7Fcn1cCYKY,4300
|
|
35
|
+
schemathesis/config/_env.py,sha256=8XfIyrnGNQuCDnfG0lwmKRFbasRUjgeQGBAMupsmtOU,613
|
|
36
|
+
schemathesis/config/_error.py,sha256=0QnXO7Zagr69aYsX46GHm5xcTDd_18m8pFQBb0SsYvY,5777
|
|
37
|
+
schemathesis/config/_generation.py,sha256=vKb-M1u7SQuNucnmRDMlMXtqZCwnxMVKMXWAeiHRzUA,5688
|
|
38
|
+
schemathesis/config/_health_check.py,sha256=zC9inla5ibMBlEy5WyM4_TME7ju_KH3Bwfo21RI3Gks,561
|
|
39
|
+
schemathesis/config/_operations.py,sha256=kXmyMWcX-ysgj8Z85mnC_vZpOqihJ0RQb5LcAtczZLw,12398
|
|
40
|
+
schemathesis/config/_output.py,sha256=3G9SOi-4oNcQPHeNRG3HggFCwvcKOW1kF28a9m0H-pU,4434
|
|
41
|
+
schemathesis/config/_parameters.py,sha256=i76Hwaf834fBAMmtKfKTl1SFCicJ-Y-5tZt5QNGW2fA,618
|
|
42
|
+
schemathesis/config/_phases.py,sha256=vezsRZAdDmtPcOjwdwAmtdb6Hkkj9gMRsdVKah71Zio,8777
|
|
43
|
+
schemathesis/config/_projects.py,sha256=LKZZdLOfXo0c96Xch_ami-YWO9nLuA2KLYmFUKtNHXE,20051
|
|
44
|
+
schemathesis/config/_rate_limit.py,sha256=ekEW-jP_Ichk_O6hYpj-h2TTTKfp7Fm0nyFUbvlWcbA,456
|
|
45
|
+
schemathesis/config/_report.py,sha256=ZECDpaCY4WWHD5UbjvgZoSjLz-rlTvfd5Ivzdgzqf2I,3891
|
|
46
|
+
schemathesis/config/_validator.py,sha256=IcE8geFZ0ZwR18rkIRs25i7pTl7Z84XbjYGUB-mqReU,258
|
|
47
|
+
schemathesis/config/_warnings.py,sha256=Fe_91RiEtFrSpjLhq5ddfA1tbebBZtSuqDQUIwBYy1w,3137
|
|
48
|
+
schemathesis/config/schema.json,sha256=3syuvrHthkMT--J-b06mEfWIGeeVeiMTbZvCWD_OVDI,21081
|
|
49
|
+
schemathesis/core/__init__.py,sha256=tackPPn7JRsEfNf57-_7zPJKQd-SWdGW17og2ZPhf6s,2067
|
|
50
|
+
schemathesis/core/adapter.py,sha256=zwJ0vNhalrF9sYXN8_0pMSkJ71GPDnUBKqBCVsnuVIY,951
|
|
51
|
+
schemathesis/core/compat.py,sha256=B8iesdVim1NcqMDMkVr-Nw_m6sbdF68H66WVV_jeRlQ,1026
|
|
52
|
+
schemathesis/core/control.py,sha256=IzwIc8HIAEMtZWW0Q0iXI7T1niBpjvcLlbuwOSmy5O8,130
|
|
53
|
+
schemathesis/core/curl.py,sha256=xSBCHH-leCcVAuSRNTBxROXcNiKN8o2Ll2JlSM-fcak,3073
|
|
54
|
+
schemathesis/core/deserialization.py,sha256=BZpTlQdG_1FGnP7au5-hKu3ugs_RUz77Hgiy59rJONI,7601
|
|
55
|
+
schemathesis/core/errors.py,sha256=eBu6oyDr_hgjI6M8_f8wZPDni4lYAW1R5V9h4Z739FQ,21130
|
|
56
|
+
schemathesis/core/failures.py,sha256=yFpAxWdEnm0Ri8z8RqRI9H7vcLH5ztOeSIi4m4SGx5g,8996
|
|
57
|
+
schemathesis/core/fs.py,sha256=ItQT0_cVwjDdJX9IiI7EnU75NI2H3_DCEyyUjzg_BgI,472
|
|
58
|
+
schemathesis/core/hooks.py,sha256=qhbkkRSf8URJ4LKv2wmKRINKpquUOgxQzWBHKWRWo3Q,475
|
|
59
|
+
schemathesis/core/lazy_import.py,sha256=aMhWYgbU2JOltyWBb32vnWBb6kykOghucEzI_F70yVE,470
|
|
60
|
+
schemathesis/core/loaders.py,sha256=04WRkiWfWPH4xjgi0nMO1NyjGw8zvraIq6PqMqCq1c4,3590
|
|
61
|
+
schemathesis/core/marks.py,sha256=SH7jsVuNRJjx2gZN9Ze5MY01u7FJiHeO0iruzKi5rm4,2135
|
|
62
|
+
schemathesis/core/media_types.py,sha256=a7dXPw6w8RMmDOw8e6hgg2Ey2oRHiANZxEzuElDMfZo,2269
|
|
63
|
+
schemathesis/core/parameters.py,sha256=SSyIJzkJ-5r4TiYYebC7jCHi1Rt2hvTNlEog-3Yvjc8,1022
|
|
64
|
+
schemathesis/core/rate_limit.py,sha256=7tg9Znk11erTfw8-ANutjEmu7hbfUHZx_iEdkoaP174,1757
|
|
65
|
+
schemathesis/core/registries.py,sha256=ksWLxPcohKInH9DwB56KNK0AwGO0Gk5LR2z_Q7cRvps,884
|
|
66
|
+
schemathesis/core/result.py,sha256=d449YvyONjqjDs-A5DAPgtAI96iT753K8sU6_1HLo2Q,461
|
|
67
|
+
schemathesis/core/schema_analysis.py,sha256=DfDqmFNywKhUE-6Y-mTcoH3wF4jwrH4_ZK-Z41h-DdQ,351
|
|
68
|
+
schemathesis/core/shell.py,sha256=sBHY-YWqrNhjnbvyBbAmEniPs5OwAFOOj8tAA52KU1Q,5832
|
|
69
|
+
schemathesis/core/transforms.py,sha256=n_inn8Vb-CFiDUd9Z8E7JIp2kn2eAnxO8DD3OSwOTiM,4310
|
|
70
|
+
schemathesis/core/transport.py,sha256=LQcamAkFqJ0HuXQzepevAq2MCJW-uq5Nm-HE9yc7HMI,7503
|
|
71
|
+
schemathesis/core/validation.py,sha256=b0USkKzkWvdz3jOW1JXYc_TfYshfKZeP7xAUnMqcNoc,2303
|
|
72
|
+
schemathesis/core/version.py,sha256=dOBUWrY3-uA2NQXJp9z7EtZgkR6jYeLg8sMhQCL1mcI,205
|
|
73
|
+
schemathesis/core/jsonschema/__init__.py,sha256=gBZGsXIpK2EFfcp8x0b69dqzWAm2OeZHepKImkkLvoE,320
|
|
74
|
+
schemathesis/core/jsonschema/bundler.py,sha256=a8cQMJ7EQe3eWvS3haS2ZpxOUwzA4PY4OLI0Uyx045A,8472
|
|
75
|
+
schemathesis/core/jsonschema/keywords.py,sha256=ssys1lgo4T_-B0VjWTAp91cga1wxwufxlb3-MI75ioY,796
|
|
76
|
+
schemathesis/core/jsonschema/references.py,sha256=c2Q4IKWUbwENNtkbFaqf8r3LLZu6GFE5YLnYQlg5tPg,6069
|
|
77
|
+
schemathesis/core/jsonschema/types.py,sha256=C7f9g8yKFuoxC5_0YNIh8QAyGU0-tj8pzTMfMDjjjVM,1248
|
|
78
|
+
schemathesis/core/output/__init__.py,sha256=SiHqONFskXl73AtP5dV29L14nZoKo7B-IeG52KZB32M,1446
|
|
79
|
+
schemathesis/core/output/sanitization.py,sha256=Ev3tae8dVwsYd7yVb2_1VBFYs92WFsQ4Eu1fGaymItE,2013
|
|
80
|
+
schemathesis/engine/__init__.py,sha256=QaFE-FinaTAaarteADo2RRMJ-Sz6hZB9TzD5KjMinIA,706
|
|
81
|
+
schemathesis/engine/context.py,sha256=5VVnFVRXePK_aJFpyw9p-apZM1wYDr5eQgGSssbSloQ,5390
|
|
82
|
+
schemathesis/engine/control.py,sha256=FXzP8dxL47j1Giqpy2-Bsr_MdMw9YiATSK_UfpFwDtk,1348
|
|
83
|
+
schemathesis/engine/core.py,sha256=rucLeczgmvFuyZAUqWMYziDd7AWOAwiZT7Dp5S8g76M,6897
|
|
84
|
+
schemathesis/engine/errors.py,sha256=ozUEukw4fCJEEWvekfRbBvizEtC3yV4QsB_wJS6t8OU,17481
|
|
85
|
+
schemathesis/engine/events.py,sha256=03Oufa6yuVUTwLohtHbkph0bOKVObAAg3NORsuoU_2Q,7058
|
|
86
|
+
schemathesis/engine/observations.py,sha256=T-5R8GeVIqvxpCMxc6vZ04UUxUTx3w7689r3Dc6bIcE,1416
|
|
87
|
+
schemathesis/engine/recorder.py,sha256=Q_Bufl9vADke7W_jVppC-34wF72oGqs7kZXBPpJwafc,8635
|
|
88
|
+
schemathesis/engine/phases/__init__.py,sha256=p96yAJQf_ZwRPyGrfGREK8S9hG6rJPwSSAbB7D0Go88,3544
|
|
89
|
+
schemathesis/engine/phases/analysis.py,sha256=E6jlwac_vE37BDeOQDQy8K9TlyY51XIorn3OJUp4VYE,979
|
|
90
|
+
schemathesis/engine/phases/probes.py,sha256=YogjJcZJcTMS8sMdGnG4oXKmMUj_4r_J7MY-BBJtCRU,5690
|
|
91
|
+
schemathesis/engine/phases/stateful/__init__.py,sha256=Lz1rgNqCfUSIz173XqCGsiMuUI5bh4L-RIFexU1-c_Q,2461
|
|
92
|
+
schemathesis/engine/phases/stateful/_executor.py,sha256=-yI5H7gUFHaNgINZ9e8lyp8-mYtgVOfH7UHAeI5n8Qw,15539
|
|
93
|
+
schemathesis/engine/phases/stateful/context.py,sha256=A7X1SLDOWFpCvFN9IiIeNVZM0emjqatmJL_k9UsO7vM,2946
|
|
94
|
+
schemathesis/engine/phases/unit/__init__.py,sha256=VQPueqKenVy6bHaoT2EtYkAlj8idd-uOvWWAswfDrLU,9125
|
|
95
|
+
schemathesis/engine/phases/unit/_executor.py,sha256=xnVSz3bWtYtxmkKrG4xpD2NdWbKJrpA2ylyeUx8mDS8,17906
|
|
96
|
+
schemathesis/engine/phases/unit/_pool.py,sha256=iU0hdHDmohPnEv7_S1emcabuzbTf-Cznqwn0pGQ5wNQ,2480
|
|
97
|
+
schemathesis/generation/__init__.py,sha256=tvNO2FLiY8z3fZ_kL_QJhSgzXfnT4UqwSXMHCwfLI0g,645
|
|
98
|
+
schemathesis/generation/case.py,sha256=GNVuhdJn77KI05uTzSOvHDDCRrcQIhodFkzZij53yjc,19084
|
|
99
|
+
schemathesis/generation/coverage.py,sha256=l_5iowdYjoXaZJS8TdjbXpEif20o-TIGI4xWmdwNNwU,67284
|
|
100
|
+
schemathesis/generation/meta.py,sha256=rxoPmFoGDoG-AWtHzfv0hDUKZU9eCe0FgNRZI8-gXy8,6730
|
|
101
|
+
schemathesis/generation/metrics.py,sha256=cZU5HdeAMcLFEDnTbNE56NuNq4P0N4ew-g1NEz5-kt4,2836
|
|
102
|
+
schemathesis/generation/modes.py,sha256=Q1fhjWr3zxabU5qdtLvKfpMFZJAwlW9pnxgenjeXTyU,481
|
|
103
|
+
schemathesis/generation/overrides.py,sha256=LCafw4GlG3OLVjhwKd2uMC3dAYRQMy9QL-7JUXncnEA,4265
|
|
104
|
+
schemathesis/generation/hypothesis/__init__.py,sha256=gohglcUDguZAQTVaS7A2gmOMyZuL1qWJw5rE80gEXBQ,4794
|
|
105
|
+
schemathesis/generation/hypothesis/builder.py,sha256=_4Cg8fXY9p3dKf_cCNUNaohqRmayPkUuz_PON0WIows,40171
|
|
106
|
+
schemathesis/generation/hypothesis/examples.py,sha256=uHzgJDvQo6Fg5c3Ez5N9DbEfuO4ULnfjE0xcRHUyn4c,1712
|
|
107
|
+
schemathesis/generation/hypothesis/given.py,sha256=9NO3aLV32Jdi7ZK0gOrIaUFCo5TSMPBZKpxpwdH4wRU,2321
|
|
108
|
+
schemathesis/generation/hypothesis/reporting.py,sha256=emvD7Re-JKl2uUeHgmLx6cHFg56_cT8TnmU6BQ9BJF4,11479
|
|
109
|
+
schemathesis/generation/stateful/__init__.py,sha256=s7jiJEnguIj44IsRyMi8afs-8yjIUuBbzW58bH5CHjs,1042
|
|
110
|
+
schemathesis/generation/stateful/state_machine.py,sha256=ITnL_2iQ3mToStjvawU9NUOQTMhxx9SWamhMQGHpfXg,9570
|
|
111
|
+
schemathesis/graphql/__init__.py,sha256=_eO6MAPHGgiADVGRntnwtPxmuvk666sAh-FAU4cG9-0,326
|
|
112
|
+
schemathesis/graphql/checks.py,sha256=IADbxiZjgkBWrC5yzHDtohRABX6zKXk5w_zpWNwdzYo,3186
|
|
113
|
+
schemathesis/graphql/loaders.py,sha256=2tgG4HIvFmjHLr_KexVXnT8hSBM-dKG_fuXTZgE97So,9445
|
|
114
|
+
schemathesis/openapi/__init__.py,sha256=-KcsSAM19uOM0N5J4s-yTnQ1BFsptYhW1E51cEf6kVM,311
|
|
115
|
+
schemathesis/openapi/checks.py,sha256=icUnRTkfFNP0nOYCyaj7hFHO8gJic0XPKxP0xHkm0Qw,13062
|
|
116
|
+
schemathesis/openapi/loaders.py,sha256=aaCIf6P8R33l6DBNGD_99m_wruYOPR7ecyL5hT6UChg,10710
|
|
117
|
+
schemathesis/openapi/generation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
118
|
+
schemathesis/openapi/generation/filters.py,sha256=pY9cUZdL_kQK80Z2aylTOqqa12zmaYUlYC5BfYgeQMk,2395
|
|
119
|
+
schemathesis/pytest/__init__.py,sha256=7W0q-Thcw03IAQfXE_Mo8JPZpUdHJzfu85fjK1ZdfQM,88
|
|
120
|
+
schemathesis/pytest/control_flow.py,sha256=RM1RCHCozJOSi9NZFOAlgu0P91bxXb-gWiK-KnE38Dw,223
|
|
121
|
+
schemathesis/pytest/lazy.py,sha256=u4sxm935zyGinFkiKN_lIuz-erg4gRYDiLjHykM0Fd8,13419
|
|
122
|
+
schemathesis/pytest/loaders.py,sha256=Sbv8e5F77_x4amLP50iwubfm6kpOhx7LhLFGsVXW5Ys,925
|
|
123
|
+
schemathesis/pytest/plugin.py,sha256=pLf0pNS1QVQ_EFZLKOrbKpKXZ8FSRjiYJMwUDt8tRFM,14960
|
|
124
|
+
schemathesis/python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
125
|
+
schemathesis/python/asgi.py,sha256=5PyvuTBaivvyPUEi3pwJni91K1kX5Zc0u9c6c1D8a1Q,287
|
|
126
|
+
schemathesis/python/wsgi.py,sha256=uShAgo_NChbfYaV1117e6UHp0MTg7jaR0Sy_to3Jmf8,219
|
|
127
|
+
schemathesis/specs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
128
|
+
schemathesis/specs/graphql/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
129
|
+
schemathesis/specs/graphql/nodes.py,sha256=bE3G1kNmqJ8OV4igBvIK-UORrkQA6Nofduf87O3TD9I,541
|
|
130
|
+
schemathesis/specs/graphql/scalars.py,sha256=6lew8mnwhrtg23leiEbG43mLGPLlRln8mClCY94XpDA,2680
|
|
131
|
+
schemathesis/specs/graphql/schemas.py,sha256=ihgDWLouXu5HrjaSEjzsEW97ktOQvdu8pyDODjx_nu0,14802
|
|
132
|
+
schemathesis/specs/graphql/validation.py,sha256=-W1Noc1MQmTb4RX-gNXMeU2qkgso4mzVfHxtdLkCPKM,1422
|
|
133
|
+
schemathesis/specs/openapi/__init__.py,sha256=C5HOsfuDJGq_3mv8CRBvRvb0Diy1p0BFdqyEXMS-loE,238
|
|
134
|
+
schemathesis/specs/openapi/_hypothesis.py,sha256=2Ce3dvmrMqTFw_popNtKL25C1X7r0E8Yh2GFIaPfx_4,27782
|
|
135
|
+
schemathesis/specs/openapi/analysis.py,sha256=mmVaQlCWzeUWDozIov2P8SB-3Hd4fDmvQ4q8SyCjxMw,3767
|
|
136
|
+
schemathesis/specs/openapi/checks.py,sha256=IyO_cemvIvAUlvH2uGtOZ0Ura4KRGulOcZIeSkiXOd4,32267
|
|
137
|
+
schemathesis/specs/openapi/converter.py,sha256=OlvGCCDAiIZS_osM9OQBvDGzwEToUZmVWwzQa4wQNws,6463
|
|
138
|
+
schemathesis/specs/openapi/definitions.py,sha256=8htclglV3fW6JPBqs59lgM4LnA25Mm9IptXBPb_qUT0,93949
|
|
139
|
+
schemathesis/specs/openapi/examples.py,sha256=_rXuj8yeuNGcOIlS_S25fOJ9d8ntyhQks_m8LclqDG0,26568
|
|
140
|
+
schemathesis/specs/openapi/formats.py,sha256=4tYRdckauHxkJCmOhmdwDq_eOpHPaKloi89lzMPbPzw,3975
|
|
141
|
+
schemathesis/specs/openapi/media_types.py,sha256=F5M6TKl0s6Z5X8mZpPsWDEdPBvxclKRcUOc41eEwKbo,2472
|
|
142
|
+
schemathesis/specs/openapi/patterns.py,sha256=GqPZEXMRdWENQxanWjBOalIZ2MQUjuxk21kmdiI703E,18027
|
|
143
|
+
schemathesis/specs/openapi/references.py,sha256=Jez2KpfsDIwXSvxZCmRQtlHk2X9UZ-JZkKAJaCPSLk8,2981
|
|
144
|
+
schemathesis/specs/openapi/schemas.py,sha256=H5ip1IhV8wlkdvEmJNzH7f4zUQTOkGDBBmbF_w6QZiA,35912
|
|
145
|
+
schemathesis/specs/openapi/serialization.py,sha256=RPNdadne5wdhsGmjSvgKLRF58wpzpRx3wura8PsHM3o,12152
|
|
146
|
+
schemathesis/specs/openapi/utils.py,sha256=XkOJT8qD-6uhq-Tmwxk_xYku1Gy5F9pKL3ldNg_DRZw,522
|
|
147
|
+
schemathesis/specs/openapi/warnings.py,sha256=nBPqq2Zi5RkDmdH3ZCunVOqpvnR3LCBJQIcXCj6qMXo,2480
|
|
148
|
+
schemathesis/specs/openapi/adapter/__init__.py,sha256=YEovBgLjnXd3WGPMJXq0KbSGHezkRlEv4dNRO7_evfk,249
|
|
149
|
+
schemathesis/specs/openapi/adapter/parameters.py,sha256=sxFl4yj6eiM-NM7-J0PHhK-5dCpK0qesZLVSJwaPO5s,28780
|
|
150
|
+
schemathesis/specs/openapi/adapter/protocol.py,sha256=VDF6COcilHEUnmw76YBVur8bFiTFQHsNvaO9pR_i_KM,2709
|
|
151
|
+
schemathesis/specs/openapi/adapter/references.py,sha256=6M59pJy_U_sLh3Xzgu6-izWXtz3bjXnqJYSD65wRHtk,549
|
|
152
|
+
schemathesis/specs/openapi/adapter/responses.py,sha256=_nYZTEShJqA2OZvRjgACXnrPUqufZUKAOSAkeruBUnc,13970
|
|
153
|
+
schemathesis/specs/openapi/adapter/security.py,sha256=kJzEEn5aQmWlOj-hnW-KRIjrRILPxNh_yvlu7xsQYQM,5146
|
|
154
|
+
schemathesis/specs/openapi/adapter/v2.py,sha256=2Rd1cTv7_I5QrBPLVfa2yD80NAErxV3tdeACjtEfXAA,1280
|
|
155
|
+
schemathesis/specs/openapi/adapter/v3_0.py,sha256=8bOE9WUDrvPivGs0w-S1PP2TXgWuaoTzMdg2_WWbi-E,1272
|
|
156
|
+
schemathesis/specs/openapi/adapter/v3_1.py,sha256=Hi4iMQdLDAeqSVYjafXbRb5yolWuqMz9A954tE2SCQY,1282
|
|
157
|
+
schemathesis/specs/openapi/expressions/__init__.py,sha256=hfuRtXD75tQFhzSo6QgDZ3zByyWeZRKevB8edszAVj4,2272
|
|
158
|
+
schemathesis/specs/openapi/expressions/errors.py,sha256=YLVhps-sYcslgVaahfcUYxUSHlIfWL-rQMeT5PZSMZ8,219
|
|
159
|
+
schemathesis/specs/openapi/expressions/extractors.py,sha256=IvOrgq_1IWNnirOSV_wLi0UcWOTiL-mLvBLFzLwRpVA,498
|
|
160
|
+
schemathesis/specs/openapi/expressions/lexer.py,sha256=ZbYPbVX-2c2Dan-6fi4NrDlFT6N55Wrz-4921TKHlZs,4030
|
|
161
|
+
schemathesis/specs/openapi/expressions/nodes.py,sha256=qaFpAM3seIzmlYLr9So2kRCSNrteZTa7djcRiOD_ji4,4811
|
|
162
|
+
schemathesis/specs/openapi/expressions/parser.py,sha256=e-ZxshrGE_5CVbgcZLYgdGSjdifgyzgKkLQp0dI0cJY,4503
|
|
163
|
+
schemathesis/specs/openapi/negative/__init__.py,sha256=lHEyJijzgDzrMVtdrEovQYibPYGeA0phWQTjtsus-dA,5240
|
|
164
|
+
schemathesis/specs/openapi/negative/mutations.py,sha256=32l3SRGLZVHEifqrbBP9h93fnBMzowl3cvW3TRFEjZk,26290
|
|
165
|
+
schemathesis/specs/openapi/negative/types.py,sha256=a7buCcVxNBG6ILBM3A7oNTAX0lyDseEtZndBuej8MbI,174
|
|
166
|
+
schemathesis/specs/openapi/negative/utils.py,sha256=ozcOIuASufLqZSgnKUACjX-EOZrrkuNdXX0SDnLoGYA,168
|
|
167
|
+
schemathesis/specs/openapi/stateful/__init__.py,sha256=dHGlTZEZ3fbvQRnzsNKXzyDJewgXIo29UPVSV4SaQFI,17746
|
|
168
|
+
schemathesis/specs/openapi/stateful/control.py,sha256=QaXLSbwQWtai5lxvvVtQV3BLJ8n5ePqSKB00XFxp-MA,3695
|
|
169
|
+
schemathesis/specs/openapi/stateful/inference.py,sha256=B99jSTDVi2yKxU7-raIb91xpacOrr0nZkEZY5Ej3eCY,9783
|
|
170
|
+
schemathesis/specs/openapi/stateful/links.py,sha256=HpAXXaY7goDBxHodnv_-SBOUER-43WbhixwfnCXfE84,8631
|
|
171
|
+
schemathesis/specs/openapi/stateful/dependencies/__init__.py,sha256=y81dasYvGGwE7PQsUxvOx1SE5HWBpgc8NuOJ-XnKYAA,8563
|
|
172
|
+
schemathesis/specs/openapi/stateful/dependencies/inputs.py,sha256=sQydINThS6vp9-OnTKCb_unoVP4m3Ho-0xTG0K7ps8Q,15915
|
|
173
|
+
schemathesis/specs/openapi/stateful/dependencies/models.py,sha256=KwsQBKZPFe3p1OmePbXdnbtUU75Gz_n296qmm-vy7_A,12956
|
|
174
|
+
schemathesis/specs/openapi/stateful/dependencies/naming.py,sha256=hJILmWaAE8HPSuLvwYAOwbeMkgKH1G0h6ta-OI7dHcA,13796
|
|
175
|
+
schemathesis/specs/openapi/stateful/dependencies/outputs.py,sha256=zvVUfQWNIuhMkKDpz5hsVGkkvkefLt1EswpJAnHajOw,1186
|
|
176
|
+
schemathesis/specs/openapi/stateful/dependencies/resources.py,sha256=ZW2ZlkYhmOn5o3ClVebYjPmcV_o6yNcKtkl-QRc5SwE,12405
|
|
177
|
+
schemathesis/specs/openapi/stateful/dependencies/schemas.py,sha256=qhaLy-_wIvEc5v8Cndbol5sr2EsYThm8Ri3PTA84zcU,14862
|
|
178
|
+
schemathesis/specs/openapi/types/__init__.py,sha256=dqSD8_lRW2o1TnnfLfWf8oP-wruczKQk5VXIo3-onPQ,94
|
|
179
|
+
schemathesis/specs/openapi/types/common.py,sha256=mFNqeVURRtM9OCFBo4oSGEm7MQawk31BYfwggS8Iwl8,834
|
|
180
|
+
schemathesis/specs/openapi/types/v2.py,sha256=4K0PQO8852UK1eQs42FT5sp_o3fVi9DiLT8_WVE-4v8,3709
|
|
181
|
+
schemathesis/specs/openapi/types/v3.py,sha256=6z3GdXG91CznqL2oRhrJKnMT1nLbJhf4l-eZBZyGvf0,3309
|
|
182
|
+
schemathesis/transport/__init__.py,sha256=0tkMdYJqYPb9YPQuJdpCtdBaz523jkIp1Rwkb6vADCc,8321
|
|
183
|
+
schemathesis/transport/asgi.py,sha256=qTClt6oT_xUEWnRHokACN_uqCNNUZrRPT6YG0PjbElY,926
|
|
184
|
+
schemathesis/transport/prepare.py,sha256=4LmGSiguR-rQZAKIX32Mlykp3IohsksTqYwbcN75PVE,4846
|
|
185
|
+
schemathesis/transport/requests.py,sha256=eYVazvvTKfwPQqunq-hF7puiBW0mruz07AEo8USi0QY,10730
|
|
186
|
+
schemathesis/transport/serialization.py,sha256=sUf-xGNg7XDMS96O4aIDji2CTj6zRVNvuC_xmn0yjkY,11169
|
|
187
|
+
schemathesis/transport/wsgi.py,sha256=QiTtb-1umJspvi4YBgvnvQ0RQyuYKTWAc89STN6UfLs,5932
|
|
188
|
+
schemathesis-4.4.2.dist-info/METADATA,sha256=YKo65idgqMBgdlyf63BiSTczIIOhr67EBvqQeF4gcpM,8924
|
|
189
|
+
schemathesis-4.4.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
190
|
+
schemathesis-4.4.2.dist-info/entry_points.txt,sha256=hiK3un-xfgPdwj9uj16YVDtTNpO128bmk0U82SMv8ZQ,152
|
|
191
|
+
schemathesis-4.4.2.dist-info/licenses/LICENSE,sha256=2Ve4J8v5jMQAWrT7r1nf3bI8Vflk3rZVQefiF2zpxwg,1121
|
|
192
|
+
schemathesis-4.4.2.dist-info/RECORD,,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2019 Kiwi.com
|
|
4
|
-
Copyright (c) 2020-
|
|
4
|
+
Copyright (c) 2020-2025 Dmitry Dygalo & Schemathesis.io
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
schemathesis/_compat.py
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# pylint: disable=ungrouped-imports
|
|
2
|
-
import hypothesis_jsonschema._from_schema
|
|
3
|
-
import jsonschema
|
|
4
|
-
import werkzeug
|
|
5
|
-
from hypothesis import strategies as st
|
|
6
|
-
from hypothesis.errors import InvalidArgument
|
|
7
|
-
from packaging import version
|
|
8
|
-
|
|
9
|
-
# pylint: disable=unused-import
|
|
10
|
-
|
|
11
|
-
try:
|
|
12
|
-
from importlib import metadata
|
|
13
|
-
except ImportError:
|
|
14
|
-
import importlib_metadata as metadata # type: ignore
|
|
15
|
-
|
|
16
|
-
if version.parse(werkzeug.__version__) < version.parse("2.1.0"):
|
|
17
|
-
from werkzeug.wrappers.json import JSONMixin
|
|
18
|
-
else:
|
|
19
|
-
|
|
20
|
-
class JSONMixin: # type: ignore
|
|
21
|
-
pass
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
try:
|
|
25
|
-
from hypothesis.utils.conventions import InferType
|
|
26
|
-
except ImportError:
|
|
27
|
-
InferType = type(...)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def _get_format_filter(
|
|
31
|
-
format_name: str,
|
|
32
|
-
checker: jsonschema.FormatChecker,
|
|
33
|
-
strategy: st.SearchStrategy[str],
|
|
34
|
-
) -> st.SearchStrategy[str]:
|
|
35
|
-
def check_valid(string: str) -> str:
|
|
36
|
-
try:
|
|
37
|
-
checker.check(string, format=format_name)
|
|
38
|
-
except jsonschema.FormatError as err:
|
|
39
|
-
raise InvalidArgument(
|
|
40
|
-
f"Got string={string!r} from strategy {strategy!r}, but this "
|
|
41
|
-
f"is not a valid value for the {format_name!r} checker."
|
|
42
|
-
) from err
|
|
43
|
-
return string
|
|
44
|
-
|
|
45
|
-
return strategy.map(check_valid)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
def _install_hypothesis_jsonschema_compatibility_shim() -> None:
|
|
49
|
-
"""Monkey patch ``hypothesis-jsonschema`` for compatibility reasons.
|
|
50
|
-
|
|
51
|
-
Open API < 3.1 uses ``binary`` or ``file`` values for the ``format`` keyword, intended to be used in
|
|
52
|
-
the non-JSON context of binary data. As hypothesis-jsonschema follows the JSON Schema semantic, formats that imply
|
|
53
|
-
non-string values are invalid.
|
|
54
|
-
|
|
55
|
-
Note that this solution is temporary.
|
|
56
|
-
"""
|
|
57
|
-
hypothesis_jsonschema._from_schema._get_format_filter = _get_format_filter
|
schemathesis/_hypothesis.py
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
"""High-level API for creating Hypothesis tests."""
|
|
2
|
-
import asyncio
|
|
3
|
-
import warnings
|
|
4
|
-
from typing import Any, Callable, Dict, List, Optional, Tuple
|
|
5
|
-
|
|
6
|
-
import hypothesis
|
|
7
|
-
from hypothesis import Phase
|
|
8
|
-
from hypothesis import strategies as st
|
|
9
|
-
from hypothesis.errors import HypothesisWarning, Unsatisfiable
|
|
10
|
-
from hypothesis.internal.reflection import proxies
|
|
11
|
-
from hypothesis_jsonschema._canonicalise import HypothesisRefResolutionError
|
|
12
|
-
|
|
13
|
-
from .auth import get_auth_storage_from_test
|
|
14
|
-
from .constants import DEFAULT_DEADLINE, DataGenerationMethod
|
|
15
|
-
from .exceptions import InvalidSchema
|
|
16
|
-
from .hooks import GLOBAL_HOOK_DISPATCHER, HookContext, HookDispatcher
|
|
17
|
-
from .models import APIOperation, Case
|
|
18
|
-
from .utils import GivenInput
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def create_test(
|
|
22
|
-
*,
|
|
23
|
-
operation: APIOperation,
|
|
24
|
-
test: Callable,
|
|
25
|
-
settings: Optional[hypothesis.settings] = None,
|
|
26
|
-
seed: Optional[int] = None,
|
|
27
|
-
data_generation_method: DataGenerationMethod = DataGenerationMethod.default(),
|
|
28
|
-
_given_args: Tuple[GivenInput, ...] = (),
|
|
29
|
-
_given_kwargs: Optional[Dict[str, GivenInput]] = None,
|
|
30
|
-
) -> Callable:
|
|
31
|
-
"""Create a Hypothesis test."""
|
|
32
|
-
hook_dispatcher = getattr(test, "_schemathesis_hooks", None)
|
|
33
|
-
auth_storage = get_auth_storage_from_test(test)
|
|
34
|
-
strategy = operation.as_strategy(
|
|
35
|
-
hooks=hook_dispatcher, auth_storage=auth_storage, data_generation_method=data_generation_method
|
|
36
|
-
)
|
|
37
|
-
_given_kwargs = (_given_kwargs or {}).copy()
|
|
38
|
-
_given_kwargs.setdefault("case", strategy)
|
|
39
|
-
|
|
40
|
-
# Each generated test should be a unique function. It is especially important for the case when Schemathesis runs
|
|
41
|
-
# tests in multiple threads because Hypothesis stores some internal attributes on function objects and re-writing
|
|
42
|
-
# them from different threads may lead to unpredictable side-effects.
|
|
43
|
-
|
|
44
|
-
@proxies(test) # type: ignore
|
|
45
|
-
def test_function(*args: Any, **kwargs: Any) -> Any:
|
|
46
|
-
__tracebackhide__ = True # pylint: disable=unused-variable
|
|
47
|
-
return test(*args, **kwargs)
|
|
48
|
-
|
|
49
|
-
wrapped_test = hypothesis.given(*_given_args, **_given_kwargs)(test_function)
|
|
50
|
-
if seed is not None:
|
|
51
|
-
wrapped_test = hypothesis.seed(seed)(wrapped_test)
|
|
52
|
-
if asyncio.iscoroutinefunction(test):
|
|
53
|
-
wrapped_test.hypothesis.inner_test = make_async_test(test) # type: ignore
|
|
54
|
-
setup_default_deadline(wrapped_test)
|
|
55
|
-
if settings is not None:
|
|
56
|
-
wrapped_test = settings(wrapped_test)
|
|
57
|
-
existing_settings = getattr(wrapped_test, "_hypothesis_internal_use_settings", None)
|
|
58
|
-
if existing_settings and Phase.explicit in existing_settings.phases:
|
|
59
|
-
wrapped_test = add_examples(wrapped_test, operation, hook_dispatcher=hook_dispatcher)
|
|
60
|
-
return wrapped_test
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def setup_default_deadline(wrapped_test: Callable) -> None:
|
|
64
|
-
# Quite hacky, but it is the simplest way to set up the default deadline value without affecting non-Schemathesis
|
|
65
|
-
# tests globally
|
|
66
|
-
existing_settings = getattr(wrapped_test, "_hypothesis_internal_use_settings", None)
|
|
67
|
-
if existing_settings is not None and existing_settings.deadline == hypothesis.settings.default.deadline:
|
|
68
|
-
with warnings.catch_warnings():
|
|
69
|
-
warnings.simplefilter("ignore", HypothesisWarning)
|
|
70
|
-
new_settings = hypothesis.settings(existing_settings, deadline=DEFAULT_DEADLINE)
|
|
71
|
-
wrapped_test._hypothesis_internal_use_settings = new_settings # type: ignore
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
def make_async_test(test: Callable) -> Callable:
|
|
75
|
-
def async_run(*args: Any, **kwargs: Any) -> None:
|
|
76
|
-
loop = asyncio.get_event_loop()
|
|
77
|
-
coro = test(*args, **kwargs)
|
|
78
|
-
future = asyncio.ensure_future(coro, loop=loop)
|
|
79
|
-
loop.run_until_complete(future)
|
|
80
|
-
|
|
81
|
-
return async_run
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
def add_examples(test: Callable, operation: APIOperation, hook_dispatcher: Optional[HookDispatcher] = None) -> Callable:
|
|
85
|
-
"""Add examples to the Hypothesis test, if they are specified in the schema."""
|
|
86
|
-
try:
|
|
87
|
-
examples: List[Case] = [get_single_example(strategy) for strategy in operation.get_strategies_from_examples()]
|
|
88
|
-
except (InvalidSchema, HypothesisRefResolutionError, Unsatisfiable):
|
|
89
|
-
# Invalid schema:
|
|
90
|
-
# In this case, the user didn't pass `--validate-schema=false` and see an error in the output anyway,
|
|
91
|
-
# and no tests will be executed. For this reason, examples can be skipped
|
|
92
|
-
# Recursive references: This test will be skipped anyway
|
|
93
|
-
# Unsatisfiable:
|
|
94
|
-
# The underlying schema is not satisfiable and test will raise an error for the same reason.
|
|
95
|
-
# Skipping this exception here allows us to continue the testing process for other operations.
|
|
96
|
-
# Still, we allow running user-defined hooks
|
|
97
|
-
examples = []
|
|
98
|
-
context = HookContext(operation) # context should be passed here instead
|
|
99
|
-
GLOBAL_HOOK_DISPATCHER.dispatch("before_add_examples", context, examples)
|
|
100
|
-
operation.schema.hooks.dispatch("before_add_examples", context, examples)
|
|
101
|
-
if hook_dispatcher:
|
|
102
|
-
hook_dispatcher.dispatch("before_add_examples", context, examples)
|
|
103
|
-
for example in examples:
|
|
104
|
-
test = hypothesis.example(case=example)(test)
|
|
105
|
-
return test
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
def get_single_example(strategy: st.SearchStrategy[Case]) -> Case:
|
|
109
|
-
@hypothesis.given(strategy) # type: ignore
|
|
110
|
-
@hypothesis.settings( # type: ignore
|
|
111
|
-
database=None,
|
|
112
|
-
max_examples=1,
|
|
113
|
-
deadline=None,
|
|
114
|
-
verbosity=hypothesis.Verbosity.quiet,
|
|
115
|
-
phases=(hypothesis.Phase.generate,),
|
|
116
|
-
suppress_health_check=hypothesis.HealthCheck.all(),
|
|
117
|
-
)
|
|
118
|
-
def example_generating_inner_function(ex: Case) -> None:
|
|
119
|
-
examples.append(ex)
|
|
120
|
-
|
|
121
|
-
examples: List[Case] = []
|
|
122
|
-
example_generating_inner_function()
|
|
123
|
-
return examples[0]
|