schemathesis 3.33.1__py3-none-any.whl → 3.33.3__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.
@@ -21,7 +21,7 @@ def group_by_case(
21
21
  yield (sample, gen)
22
22
 
23
23
 
24
- def _by_unique_key(check: SerializedCheck, code_sample_style: CodeSampleStyle) -> tuple[str, int | None, str | None]:
24
+ def _by_unique_key(check: SerializedCheck, code_sample_style: CodeSampleStyle) -> tuple[str, int, str]:
25
25
  return (
26
26
  code_sample_style.generate(
27
27
  method=check.example.method,
@@ -31,8 +31,10 @@ def _by_unique_key(check: SerializedCheck, code_sample_style: CodeSampleStyle) -
31
31
  verify=check.example.verify,
32
32
  extra_headers=check.example.extra_headers,
33
33
  ),
34
- None if not check.response else check.response.status_code,
35
- None if not check.response else check.response.body,
34
+ 0 if not check.response else check.response.status_code,
35
+ "SCHEMATHESIS-INTERNAL-NO-RESPONSE"
36
+ if not check.response
37
+ else check.response.body or "SCHEMATHESIS-INTERNAL-EMPTY-BODY",
36
38
  )
37
39
 
38
40
 
@@ -12,6 +12,7 @@ from hypothesis_jsonschema import from_schema
12
12
 
13
13
  from ..._hypothesis import get_single_example
14
14
  from ...constants import DEFAULT_RESPONSE_TIMEOUT
15
+ from ...internal.copy import fast_deepcopy
15
16
  from ...models import APIOperation, Case
16
17
  from ._hypothesis import get_case_strategy, get_default_format_strategies
17
18
  from .constants import LOCATION_TO_CONTAINER
@@ -130,10 +131,26 @@ def extract_top_level(operation: APIOperation[OpenAPIParameter, Case]) -> Genera
130
131
  def _expand_subschemas(schema: dict[str, Any] | bool) -> Generator[dict[str, Any] | bool, None, None]:
131
132
  yield schema
132
133
  if isinstance(schema, dict):
133
- for key in ("anyOf", "oneOf", "allOf"):
134
+ for key in ("anyOf", "oneOf"):
134
135
  if key in schema:
135
136
  for subschema in schema[key]:
136
137
  yield subschema
138
+ if "allOf" in schema:
139
+ subschema = fast_deepcopy(schema["allOf"][0])
140
+ for sub in schema["allOf"][1:]:
141
+ if isinstance(sub, dict):
142
+ for key, value in sub.items():
143
+ if key == "properties":
144
+ subschema.setdefault("properties", {}).update(value)
145
+ elif key == "required":
146
+ subschema.setdefault("required", []).extend(value)
147
+ elif key == "examples":
148
+ subschema.setdefault("examples", []).extend(value)
149
+ elif key == "example":
150
+ subschema.setdefault("examples", []).append(value)
151
+ else:
152
+ subschema[key] = value
153
+ yield subschema
137
154
 
138
155
 
139
156
  def _find_parameter_examples_definition(
@@ -1,8 +1,11 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from dataclasses import dataclass, field
4
+ from datetime import timedelta
4
5
  from typing import TYPE_CHECKING, Any
5
6
 
7
+ from ..constants import DEFAULT_DEADLINE
8
+
6
9
  if TYPE_CHECKING:
7
10
  import hypothesis
8
11
  from requests.auth import HTTPDigestAuth
@@ -24,7 +27,7 @@ def _default_checks_factory() -> tuple[CheckFunction, ...]:
24
27
  def _get_default_hypothesis_settings_kwargs() -> dict[str, Any]:
25
28
  import hypothesis
26
29
 
27
- return {"phases": (hypothesis.Phase.generate,), "deadline": None}
30
+ return {"phases": (hypothesis.Phase.generate,), "deadline": None, "stateful_step_count": 10}
28
31
 
29
32
 
30
33
  def _default_hypothesis_settings_factory() -> hypothesis.settings:
@@ -79,6 +82,8 @@ def _get_hypothesis_settings_kwargs_override(settings: hypothesis.settings) -> d
79
82
  state_machine_default = _default_hypothesis_settings_factory()
80
83
  if settings.phases == hypothesis_default.phases:
81
84
  kwargs["phases"] = state_machine_default.phases
82
- if settings.deadline == hypothesis_default.deadline:
85
+ if settings.stateful_step_count == hypothesis_default.stateful_step_count:
86
+ kwargs["stateful_step_count"] = state_machine_default.stateful_step_count
87
+ if settings.deadline in (hypothesis_default.deadline, timedelta(milliseconds=DEFAULT_DEADLINE)):
83
88
  kwargs["deadline"] = state_machine_default.deadline
84
89
  return kwargs
@@ -10,6 +10,7 @@ import hypothesis
10
10
  import requests
11
11
  from hypothesis.control import current_build_context
12
12
  from hypothesis.errors import Flaky
13
+ from hypothesis.stateful import Rule
13
14
 
14
15
  from ..exceptions import CheckFailed
15
16
  from ..targets import TargetMetricCollector
@@ -139,6 +140,9 @@ def _execute_state_machine_loop(
139
140
  def get_call_kwargs(self, case: Case) -> dict[str, Any]:
140
141
  return call_kwargs
141
142
 
143
+ def _repr_step(self, rule: Rule, data: dict, result: StepResult) -> str:
144
+ return ""
145
+
142
146
  if config.override is not None:
143
147
 
144
148
  def before_call(self, case: Case) -> None:
@@ -58,7 +58,7 @@ def validate_response(
58
58
  )
59
59
  check_results.append(passed_check)
60
60
 
61
- for check in checks + additional_checks:
61
+ for check in tuple(checks) + tuple(additional_checks):
62
62
  name = check.__name__
63
63
  copied_case = case.partial_deepcopy()
64
64
  try:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: schemathesis
3
- Version: 3.33.1
3
+ Version: 3.33.3
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://schemathesis.readthedocs.io/en/stable/changelog.html
@@ -37,7 +37,7 @@ schemathesis/cli/debug.py,sha256=_YA-bX1ujHl4bqQDEum7M-I2XHBTEGbvgkhvcvKhmgU,658
37
37
  schemathesis/cli/handlers.py,sha256=RjvogPCqqFTiyVYWrGG6euw9-6h-7uSeFvS-ouU8eWs,389
38
38
  schemathesis/cli/junitxml.py,sha256=yWacOIrTC9UI-IlgZnu8nfSmpkxfMT22NqJ3L1SZa3w,4743
39
39
  schemathesis/cli/options.py,sha256=DY5PUzpUNyYgpcqqFTeZjmVUykpbaI9fbN44QIWNOfA,2559
40
- schemathesis/cli/reporting.py,sha256=AT8ZjSUeH0S9Dl1ZhvTw0CJPy1JdIIRuRWxsJXfFpjc,3521
40
+ schemathesis/cli/reporting.py,sha256=zNKaRAUfDZ23-gMtiWbnG2OBndkYlM7ljKvk0Mc_lqI,3589
41
41
  schemathesis/cli/sanitization.py,sha256=pVlQnVDC1_Ugp0oe1LEkRorFdBRDHqr_NWWKaOaNdY0,728
42
42
  schemathesis/cli/output/__init__.py,sha256=AXaUzQ1nhQ-vXhW4-X-91vE2VQtEcCOrGtQXXNN55iQ,29
43
43
  schemathesis/cli/output/default.py,sha256=nYuUwm2M3pIsDebofgXuIFb7Vl4t4sLO0PKmJcE6tb8,39385
@@ -104,7 +104,7 @@ schemathesis/specs/openapi/checks.py,sha256=eFjbV9-0202qg0s0JjaBNRr7nf8Bd8VMLPHE
104
104
  schemathesis/specs/openapi/constants.py,sha256=JqM_FHOenqS_MuUE9sxVQ8Hnw0DNM8cnKDwCwPLhID4,783
105
105
  schemathesis/specs/openapi/converter.py,sha256=TaYgc5BBHPdkN-n0lqpbeVgLu3eL3L8Wu3y_Vo3TJaQ,2800
106
106
  schemathesis/specs/openapi/definitions.py,sha256=Z186F0gNBSCmPg-Kk7Q-n6XxEZHIOzgUyeqixlC62XE,94058
107
- schemathesis/specs/openapi/examples.py,sha256=t3mYEgUq-akoe3sc9r0Eqb6y2STjIM4m7Lj7kDKG57Y,15293
107
+ schemathesis/specs/openapi/examples.py,sha256=ElfX1kZ4XWfOSOVbes_ovy4P6q_NgWpa0RF0rNJLVM4,16170
108
108
  schemathesis/specs/openapi/formats.py,sha256=JmmkQWNAj5XreXb7Edgj4LADAf4m86YulR_Ec8evpJ4,1220
109
109
  schemathesis/specs/openapi/links.py,sha256=2ucOLs50OhCqu0PEdbT_BGUM3fKnHBl97YGISLpAxLY,16023
110
110
  schemathesis/specs/openapi/loaders.py,sha256=AcpvTK8qdirSRcHcinCjQbwfSQSx448LAh_GvFML1C0,25515
@@ -131,21 +131,21 @@ schemathesis/specs/openapi/stateful/__init__.py,sha256=bQLAavl0-B3hGjEgfrS8o7cPS
131
131
  schemathesis/specs/openapi/stateful/statistic.py,sha256=EJK4NqeAYRYl1FtU9YEuTLyhGhPmks0bLoxUPuQlOvM,7443
132
132
  schemathesis/specs/openapi/stateful/types.py,sha256=UuGcCTFvaHsqeLN9ZeUNcbjsEwmthoT3UcHfDHchOYo,419
133
133
  schemathesis/stateful/__init__.py,sha256=qyQJ-9Ect-AWZiAsK63F3BTGu-jZnPCOp1q46YAonkQ,4911
134
- schemathesis/stateful/config.py,sha256=rtGl3egoUuPFxrWcl5xZj_6KmKzZyYaC0b_AUotvurs,2930
134
+ schemathesis/stateful/config.py,sha256=t2_xW_4-MnrjQFiZC9heHdwP_ftHgFS-zptgq5Ba380,3235
135
135
  schemathesis/stateful/context.py,sha256=MeP3-lKyhtAd-jzApC65AWlDZSOBzQq0IgK-nvagYqs,4519
136
136
  schemathesis/stateful/events.py,sha256=reGjsmS-y2izRd3bahpEZNe4zxTSpKAkPI-nCQyoUzI,6733
137
- schemathesis/stateful/runner.py,sha256=vFd8Id3zzSQVHBK9UgInBpBT7oyUNagQ0p7ZJnPyHRk,10969
137
+ schemathesis/stateful/runner.py,sha256=tIlXRpy0Y0vuQYjTlafpZ4Ur_KhFhdK5CH7ScRvDPWk,11110
138
138
  schemathesis/stateful/sink.py,sha256=xjsqJYH5WETKh5pDGlchYyjT3HcjzHEotUjvo1p0JsE,2470
139
139
  schemathesis/stateful/state_machine.py,sha256=iRbznWxHnUdLhMpiBaHxe6Nh1EacyGnGFz4DCRwV5j4,12228
140
140
  schemathesis/stateful/statistic.py,sha256=xPLiCw61ofNXQicqcK_sZyLHiqiGcgQARpwd8AiRubM,487
141
- schemathesis/stateful/validation.py,sha256=CN0gEj1UKPLpZsvgOnovnPG_EuD4tEMkKwz_DeryTeQ,3591
141
+ schemathesis/stateful/validation.py,sha256=JtqnRzl11ZbVR8Lcr0xBJKoOXzx8VUfRz92jOnB2Smg,3605
142
142
  schemathesis/transports/__init__.py,sha256=j5WwdEzXi4XGT-Q_IrCI0fYJw19h17Qq4LJIMbmPXnk,12445
143
143
  schemathesis/transports/auth.py,sha256=yELjkEkfx4g74hNrd0Db9aFf0xDJDRIwhg2vzKOTZGg,1138
144
144
  schemathesis/transports/content_types.py,sha256=VrcRQvF5T_TUjrCyrZcYF2LOwKfs3IrLcMtkVSp1ImI,2189
145
145
  schemathesis/transports/headers.py,sha256=hr_AIDOfUxsJxpHfemIZ_uNG3_vzS_ZeMEKmZjbYiBE,990
146
146
  schemathesis/transports/responses.py,sha256=6-gvVcRK0Ho_lSydUysBNFWoJwZEiEgf6Iv-GWkQGd8,1675
147
- schemathesis-3.33.1.dist-info/METADATA,sha256=Fkjkxp4EXTL2_u0nrLQpB_FacY15xAhLcbSdojE8MYA,17795
148
- schemathesis-3.33.1.dist-info/WHEEL,sha256=hKi7AIIx6qfnsRbr087vpeJnrVUuDokDHZacPPMW7-Y,87
149
- schemathesis-3.33.1.dist-info/entry_points.txt,sha256=VHyLcOG7co0nOeuk8WjgpRETk5P1E2iCLrn26Zkn5uk,158
150
- schemathesis-3.33.1.dist-info/licenses/LICENSE,sha256=PsPYgrDhZ7g9uwihJXNG-XVb55wj2uYhkl2DD8oAzY0,1103
151
- schemathesis-3.33.1.dist-info/RECORD,,
147
+ schemathesis-3.33.3.dist-info/METADATA,sha256=KOVSCOFTMZ9DxwahBc2hsx6Qf5XR3SARyyZSnS6atfk,17795
148
+ schemathesis-3.33.3.dist-info/WHEEL,sha256=hKi7AIIx6qfnsRbr087vpeJnrVUuDokDHZacPPMW7-Y,87
149
+ schemathesis-3.33.3.dist-info/entry_points.txt,sha256=VHyLcOG7co0nOeuk8WjgpRETk5P1E2iCLrn26Zkn5uk,158
150
+ schemathesis-3.33.3.dist-info/licenses/LICENSE,sha256=PsPYgrDhZ7g9uwihJXNG-XVb55wj2uYhkl2DD8oAzY0,1103
151
+ schemathesis-3.33.3.dist-info/RECORD,,