schemathesis 4.0.20__py3-none-any.whl → 4.0.22__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.
@@ -1,8 +1,5 @@
1
1
  from typing import Any
2
2
 
3
- # Maximum test running time
4
- DEFAULT_DEADLINE = 15000
5
-
6
3
 
7
4
  def setup() -> None:
8
5
  from hypothesis import core as root_core
@@ -28,7 +28,7 @@ from schemathesis.core.transport import prepare_urlencoded
28
28
  from schemathesis.core.validation import has_invalid_characters, is_latin_1_encodable
29
29
  from schemathesis.generation import GenerationMode, coverage
30
30
  from schemathesis.generation.case import Case
31
- from schemathesis.generation.hypothesis import DEFAULT_DEADLINE, examples, setup, strategies
31
+ from schemathesis.generation.hypothesis import examples, setup, strategies
32
32
  from schemathesis.generation.hypothesis.examples import add_single_example
33
33
  from schemathesis.generation.hypothesis.given import GivenInput
34
34
  from schemathesis.generation.meta import (
@@ -124,9 +124,6 @@ def create_test(
124
124
  settings = getattr(hypothesis_test, SETTINGS_ATTRIBUTE_NAME, None)
125
125
  assert settings is not None
126
126
 
127
- if settings.deadline == default.deadline:
128
- settings = hypothesis.settings(settings, deadline=DEFAULT_DEADLINE)
129
-
130
127
  if settings.verbosity == default.verbosity:
131
128
  settings = hypothesis.settings(settings, verbosity=Verbosity.quiet)
132
129
 
schemathesis/hooks.py CHANGED
@@ -395,7 +395,7 @@ def hook(hook: str | Callable) -> Callable:
395
395
  return query and "user_id" in query
396
396
 
397
397
  @schemathesis.hook
398
- def before_call(ctx, case):
398
+ def before_call(ctx, case, **kwargs):
399
399
  \"\"\"Modify headers before sending each request\"\"\"
400
400
  if case.headers is None:
401
401
  case.headers = {}
@@ -301,6 +301,8 @@ def generate_parameter(
301
301
  if value == explicit:
302
302
  # When we pass `explicit`, then its parts are excluded from generation of the final value
303
303
  # If the final value is the same, then other parameters were generated at all
304
+ if value is not None and location == "path":
305
+ value = quote_all(value)
304
306
  used_generator = None
305
307
  return ValueContainer(value=value, location=location, generator=used_generator)
306
308
 
@@ -51,6 +51,20 @@ class BodyExample:
51
51
  Example = Union[ParameterExample, BodyExample]
52
52
 
53
53
 
54
+ def merge_kwargs(left: dict[str, Any], right: dict[str, Any]) -> dict[str, Any]:
55
+ mergeable_keys = {"path_parameters", "headers", "cookies", "query"}
56
+
57
+ for key, value in right.items():
58
+ if key in mergeable_keys and key in left:
59
+ if isinstance(left[key], dict) and isinstance(value, dict):
60
+ # kwargs takes precedence
61
+ left[key] = {**left[key], **value}
62
+ continue
63
+ left[key] = value
64
+
65
+ return left
66
+
67
+
54
68
  def get_strategies_from_examples(
55
69
  operation: APIOperation[OpenAPIParameter], **kwargs: Any
56
70
  ) -> list[SearchStrategy[Case]]:
@@ -72,7 +86,7 @@ def get_strategies_from_examples(
72
86
  # Add examples from parameter's schemas
73
87
  examples.extend(extract_from_schemas(operation))
74
88
  return [
75
- openapi_cases(operation=operation, **{**parameters, **kwargs, "phase": TestPhase.EXAMPLES}).map(
89
+ openapi_cases(operation=operation, phase=TestPhase.EXAMPLES, **merge_kwargs(parameters, kwargs)).map(
76
90
  serialize_components
77
91
  )
78
92
  for parameters in produce_combinations(examples)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: schemathesis
3
- Version: 4.0.20
3
+ Version: 4.0.22
4
4
  Summary: Property-based testing framework for Open API and GraphQL based apps
5
5
  Project-URL: Documentation, https://schemathesis.readthedocs.io/en/stable/
6
6
  Project-URL: Changelog, https://github.com/schemathesis/schemathesis/blob/master/CHANGELOG.md
@@ -3,7 +3,7 @@ schemathesis/auths.py,sha256=JdEwPRS9WKmPcxzGXYYz9pjlIUMQYCfif7ZJU0Kde-I,16400
3
3
  schemathesis/checks.py,sha256=GTdejjXDooAOuq66nvCK3i-AMPBuU-_-aNeSeL9JIlc,6561
4
4
  schemathesis/errors.py,sha256=T8nobEi5tQX_SkwaYb8JFoIlF9F_vOQVprZ8EVPAhjA,931
5
5
  schemathesis/filters.py,sha256=OEub50Ob5sf0Tn3iTeuIaxSMtepF7KVoiEM9wtt5GGA,13433
6
- schemathesis/hooks.py,sha256=L1o9IQz0_mY59gs3WGHGSCnGHjF6WWEZZuwJaHcVG1o,13922
6
+ schemathesis/hooks.py,sha256=OEnZw5lKSweNdycBRIOsn085rTB-L-iJAjj4ClldkU4,13932
7
7
  schemathesis/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  schemathesis/schemas.py,sha256=glaIjN7JO1mdOCs5_HUFjLWQ-89z8NFBUIuc5p8cLAU,28386
9
9
  schemathesis/cli/__init__.py,sha256=U9gjzWWpiFhaqevPjZbwyTNjABdpvXETI4HgwdGKnvs,877
@@ -90,8 +90,8 @@ schemathesis/generation/meta.py,sha256=adkoMuCfzSjHJ9ZDocQn0GnVldSCkLL3eVR5A_jaf
90
90
  schemathesis/generation/metrics.py,sha256=cZU5HdeAMcLFEDnTbNE56NuNq4P0N4ew-g1NEz5-kt4,2836
91
91
  schemathesis/generation/modes.py,sha256=Q1fhjWr3zxabU5qdtLvKfpMFZJAwlW9pnxgenjeXTyU,481
92
92
  schemathesis/generation/overrides.py,sha256=OBWqDQPreiliaf2M-oyXppVKHoJkCRzxtwSJx1b6AFw,3759
93
- schemathesis/generation/hypothesis/__init__.py,sha256=SVwM-rx07jPZzms0idWYACgUtWAxh49HRuTnaQ__zf0,1549
94
- schemathesis/generation/hypothesis/builder.py,sha256=J5O08kaXV8q1dcjCgjNG7eGbpvlLpqBzl6xWiYZucNc,35111
93
+ schemathesis/generation/hypothesis/__init__.py,sha256=76QYchbfeA-A_G_bP6_BkG5JO9SxIIP1yNRBZa06RvE,1495
94
+ schemathesis/generation/hypothesis/builder.py,sha256=f_5VsqeHKP-07pJZ0CPpW6YSxs9qUEseanAaxwOwdm4,34970
95
95
  schemathesis/generation/hypothesis/examples.py,sha256=6eGaKUEC3elmKsaqfKj1sLvM8EHc-PWT4NRBq4NI0Rs,1409
96
96
  schemathesis/generation/hypothesis/given.py,sha256=sTZR1of6XaHAPWtHx2_WLlZ50M8D5Rjux0GmWkWjDq4,2337
97
97
  schemathesis/generation/hypothesis/reporting.py,sha256=uDVow6Ya8YFkqQuOqRsjbzsbyP4KKfr3jA7ZaY4FuKY,279
@@ -123,12 +123,12 @@ schemathesis/specs/graphql/schemas.py,sha256=ezkqgMwx37tMWlhy_I0ahDF1Q44emDSJkyj
123
123
  schemathesis/specs/graphql/validation.py,sha256=-W1Noc1MQmTb4RX-gNXMeU2qkgso4mzVfHxtdLkCPKM,1422
124
124
  schemathesis/specs/openapi/__init__.py,sha256=C5HOsfuDJGq_3mv8CRBvRvb0Diy1p0BFdqyEXMS-loE,238
125
125
  schemathesis/specs/openapi/_cache.py,sha256=HpglmETmZU0RCHxp3DO_sg5_B_nzi54Zuw9vGzzYCxY,4295
126
- schemathesis/specs/openapi/_hypothesis.py,sha256=H-4pzT7dECY-AcDGhebKdTSELhGOdyA1WCbZQSMZY3E,22309
126
+ schemathesis/specs/openapi/_hypothesis.py,sha256=shKwQPWupBSZgZ1m35HjSJi0HX0Yv5wqjdkYWA_EE7U,22399
127
127
  schemathesis/specs/openapi/checks.py,sha256=t3ZIyzRPd_KnJzdp57Y_9CZLYC98NAqsE3dgNfuCOBA,29971
128
128
  schemathesis/specs/openapi/constants.py,sha256=JqM_FHOenqS_MuUE9sxVQ8Hnw0DNM8cnKDwCwPLhID4,783
129
129
  schemathesis/specs/openapi/converter.py,sha256=LkpCCAxZzET4Qa_3YStSNuhGlsm5G6TVwpxYu6lPO4g,4169
130
130
  schemathesis/specs/openapi/definitions.py,sha256=8htclglV3fW6JPBqs59lgM4LnA25Mm9IptXBPb_qUT0,93949
131
- schemathesis/specs/openapi/examples.py,sha256=V1fbsbMto_So7lTWnyGa7f3u9On2br8yZ-cPzcC2-Bw,21542
131
+ schemathesis/specs/openapi/examples.py,sha256=JsAy8Dexw36SUAO5MBB44ji3zEK9Y_JU5d2LRshjEI4,22023
132
132
  schemathesis/specs/openapi/formats.py,sha256=8AIS7Uey-Z1wm1WYRqnsVqHwG9d316PdqfKLqwUs7us,3516
133
133
  schemathesis/specs/openapi/media_types.py,sha256=F5M6TKl0s6Z5X8mZpPsWDEdPBvxclKRcUOc41eEwKbo,2472
134
134
  schemathesis/specs/openapi/parameters.py,sha256=ifu_QQCMUzsUHQAkvsOvLuokns6CzesssmQ3Nd3zxII,14594
@@ -157,8 +157,8 @@ schemathesis/transport/prepare.py,sha256=erYXRaxpQokIDzaIuvt_csHcw72iHfCyNq8VNEz
157
157
  schemathesis/transport/requests.py,sha256=46aplzhSmBupegPNMawma-iJWCegWkEd6mzdWLTpgM4,10742
158
158
  schemathesis/transport/serialization.py,sha256=igUXKZ_VJ9gV7P0TUc5PDQBJXl_s0kK9T3ljGWWvo6E,10339
159
159
  schemathesis/transport/wsgi.py,sha256=KoAfvu6RJtzyj24VGB8e-Iaa9smpgXJ3VsM8EgAz2tc,6152
160
- schemathesis-4.0.20.dist-info/METADATA,sha256=diXsxXNsEftDBd6avKFKX7nsuQTNRm3oKazIVDFJlhE,8472
161
- schemathesis-4.0.20.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
162
- schemathesis-4.0.20.dist-info/entry_points.txt,sha256=hiK3un-xfgPdwj9uj16YVDtTNpO128bmk0U82SMv8ZQ,152
163
- schemathesis-4.0.20.dist-info/licenses/LICENSE,sha256=2Ve4J8v5jMQAWrT7r1nf3bI8Vflk3rZVQefiF2zpxwg,1121
164
- schemathesis-4.0.20.dist-info/RECORD,,
160
+ schemathesis-4.0.22.dist-info/METADATA,sha256=H48xn669lwYErX5xaT1X0TkujlL1oJ4Kn2zdLTaN3lY,8472
161
+ schemathesis-4.0.22.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
162
+ schemathesis-4.0.22.dist-info/entry_points.txt,sha256=hiK3un-xfgPdwj9uj16YVDtTNpO128bmk0U82SMv8ZQ,152
163
+ schemathesis-4.0.22.dist-info/licenses/LICENSE,sha256=2Ve4J8v5jMQAWrT7r1nf3bI8Vflk3rZVQefiF2zpxwg,1121
164
+ schemathesis-4.0.22.dist-info/RECORD,,