schemathesis 4.0.11__py3-none-any.whl → 4.0.13__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.
@@ -159,9 +159,15 @@ class OperationsConfig(DiffBase):
159
159
  if exclude_deprecated:
160
160
  exclude_set.include(is_deprecated)
161
161
 
162
+ return self.filter_set_with(include=include_set, exclude=exclude_set)
163
+
164
+ def filter_set_with(self, include: FilterSet, exclude: FilterSet | None = None) -> FilterSet:
165
+ if not self.operations and exclude is None:
166
+ return include
162
167
  operations = list(self.operations)
163
168
 
164
169
  final = FilterSet()
170
+ exclude = exclude or FilterSet()
165
171
 
166
172
  def priority_filter(ctx: HasAPIOperation) -> bool:
167
173
  """Filter operations according to CLI and config priority."""
@@ -169,12 +175,12 @@ class OperationsConfig(DiffBase):
169
175
  if op_config._filter_set.match(ctx) and not op_config.enabled:
170
176
  return False
171
177
 
172
- if not include_set.is_empty():
173
- if exclude_set.is_empty():
174
- return include_set.match(ctx)
175
- return include_set.match(ctx) and not exclude_set.match(ctx)
176
- elif not exclude_set.is_empty():
177
- return not exclude_set.match(ctx)
178
+ if not include.is_empty():
179
+ if exclude.is_empty():
180
+ return include.match(ctx)
181
+ return include.match(ctx) and not exclude.match(ctx)
182
+ elif not exclude.is_empty():
183
+ return not exclude.match(ctx)
178
184
 
179
185
  return True
180
186
 
@@ -207,15 +207,24 @@ class Case:
207
207
  transport_ = transport.get(kwargs["app"])
208
208
  else:
209
209
  transport_ = self.operation.schema.transport
210
- response = transport_.send(
211
- self,
212
- session=session,
213
- base_url=base_url,
214
- headers=headers,
215
- params=params,
216
- cookies=cookies,
217
- **kwargs,
218
- )
210
+ try:
211
+ response = transport_.send(
212
+ self,
213
+ session=session,
214
+ base_url=base_url,
215
+ headers=headers,
216
+ params=params,
217
+ cookies=cookies,
218
+ **kwargs,
219
+ )
220
+ except Exception as exc:
221
+ # May happen in ASGI / WSGI apps
222
+ if not hasattr(exc, "__notes__"):
223
+ exc.__notes__ = [] # type: ignore[attr-defined]
224
+ verify = kwargs.get("verify", True)
225
+ curl = self.as_curl_command(headers=headers, verify=verify)
226
+ exc.__notes__.append(f"\nReproduce with: \n\n {curl}") # type: ignore[attr-defined]
227
+ raise
219
228
  dispatch("after_call", hook_context, self, response)
220
229
  return response
221
230
 
@@ -243,6 +243,7 @@ def from_dict(schema: dict[str, Any], *, config: SchemathesisConfig | None = Non
243
243
  config = SchemathesisConfig.discover()
244
244
  project_config = config.projects.get(schema)
245
245
  instance = GraphQLSchema(schema, config=project_config)
246
+ instance.filter_set = project_config.operations.filter_set_with(include=instance.filter_set)
246
247
  dispatch("after_load_schema", hook_context, instance)
247
248
  return instance
248
249
 
@@ -228,6 +228,7 @@ def from_dict(schema: dict[str, Any], *, config: SchemathesisConfig | None = Non
228
228
  LoaderErrorKind.OPEN_API_UNSPECIFIED_VERSION,
229
229
  "Unable to determine the Open API version as it's not specified in the document.",
230
230
  )
231
+ instance.filter_set = project_config.operations.filter_set_with(include=instance.filter_set)
231
232
  dispatch("after_load_schema", hook_context, instance)
232
233
  return instance
233
234
 
@@ -113,10 +113,13 @@ def prepare_request(case: Case, headers: Mapping[str, Any] | None, *, config: Sa
113
113
  kwargs = REQUESTS_TRANSPORT.serialize_case(case, base_url=base_url, headers=headers)
114
114
  if config.enabled:
115
115
  kwargs["url"] = sanitize_url(kwargs["url"], config=config)
116
+ kwargs["headers"] = dict(kwargs["headers"])
116
117
  sanitize_value(kwargs["headers"], config=config)
117
118
  if kwargs["cookies"]:
119
+ kwargs["cookies"] = dict(kwargs["cookies"])
118
120
  sanitize_value(kwargs["cookies"], config=config)
119
121
  if kwargs["params"]:
122
+ kwargs["params"] = dict(kwargs["params"])
120
123
  sanitize_value(kwargs["params"], config=config)
121
124
 
122
125
  return requests.Request(**kwargs).prepare()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: schemathesis
3
- Version: 4.0.11
3
+ Version: 4.0.13
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
@@ -36,7 +36,7 @@ schemathesis/config/_env.py,sha256=8XfIyrnGNQuCDnfG0lwmKRFbasRUjgeQGBAMupsmtOU,6
36
36
  schemathesis/config/_error.py,sha256=TxuuqQ1olwJc7P7ssfxXb1dB_Xn5uVsoazjvYvRxrxA,5437
37
37
  schemathesis/config/_generation.py,sha256=_THqCfC20i8RRRsO2hAwoJ52FV-CS1xOA6me3Wp3FHw,5087
38
38
  schemathesis/config/_health_check.py,sha256=zC9inla5ibMBlEy5WyM4_TME7ju_KH3Bwfo21RI3Gks,561
39
- schemathesis/config/_operations.py,sha256=EWUFxICG7kzr-yqBeZyZmpwCEMgDkgD7lUXrO_oCLwo,11860
39
+ schemathesis/config/_operations.py,sha256=2M36b4MMoFtaaFpe9yG-aWRqh0Qm1dpdk5M0V23X2yA,12129
40
40
  schemathesis/config/_output.py,sha256=3G9SOi-4oNcQPHeNRG3HggFCwvcKOW1kF28a9m0H-pU,4434
41
41
  schemathesis/config/_parameters.py,sha256=i76Hwaf834fBAMmtKfKTl1SFCicJ-Y-5tZt5QNGW2fA,618
42
42
  schemathesis/config/_phases.py,sha256=NFUhn-xzEQdNtgNVW1t51lMquXbjRNGR_QuiCRLCi28,6454
@@ -84,7 +84,7 @@ schemathesis/engine/phases/unit/__init__.py,sha256=BvZh39LZmXg90Cy_Tn0cQY5y7eWzY
84
84
  schemathesis/engine/phases/unit/_executor.py,sha256=9MmZoKSBVSPk0LWwN3PZ3iaO9nzpT1Z70yzdEE48YYw,16489
85
85
  schemathesis/engine/phases/unit/_pool.py,sha256=iU0hdHDmohPnEv7_S1emcabuzbTf-Cznqwn0pGQ5wNQ,2480
86
86
  schemathesis/generation/__init__.py,sha256=tvNO2FLiY8z3fZ_kL_QJhSgzXfnT4UqwSXMHCwfLI0g,645
87
- schemathesis/generation/case.py,sha256=MuqnKsJBpGm2gaqDFdJi1yGSWgBhqJUwtYaX97kfXgo,11820
87
+ schemathesis/generation/case.py,sha256=zwAwFQ-Fp7SOxCXYOQyAdwAtNwVJe63PdLpvqackFQY,12296
88
88
  schemathesis/generation/coverage.py,sha256=0d52xHf1HUbilPmCeJlplnw7knSdc0lEv4Hr0HXYUTE,49949
89
89
  schemathesis/generation/meta.py,sha256=adkoMuCfzSjHJ9ZDocQn0GnVldSCkLL3eVR5A_jafwM,2552
90
90
  schemathesis/generation/metrics.py,sha256=cZU5HdeAMcLFEDnTbNE56NuNq4P0N4ew-g1NEz5-kt4,2836
@@ -100,10 +100,10 @@ schemathesis/generation/stateful/__init__.py,sha256=s7jiJEnguIj44IsRyMi8afs-8yjI
100
100
  schemathesis/generation/stateful/state_machine.py,sha256=1cY3AH-f_AbUGfvfK8WMMKkUxAJT9Iw8eZGyRE2Sd44,8740
101
101
  schemathesis/graphql/__init__.py,sha256=_eO6MAPHGgiADVGRntnwtPxmuvk666sAh-FAU4cG9-0,326
102
102
  schemathesis/graphql/checks.py,sha256=IADbxiZjgkBWrC5yzHDtohRABX6zKXk5w_zpWNwdzYo,3186
103
- schemathesis/graphql/loaders.py,sha256=KarhFo2lDiC_1GcC2UGHl_MRDWAMMMWtE7sKrdbaJvo,9348
103
+ schemathesis/graphql/loaders.py,sha256=2tgG4HIvFmjHLr_KexVXnT8hSBM-dKG_fuXTZgE97So,9445
104
104
  schemathesis/openapi/__init__.py,sha256=-KcsSAM19uOM0N5J4s-yTnQ1BFsptYhW1E51cEf6kVM,311
105
105
  schemathesis/openapi/checks.py,sha256=VaQRxko6KwZL6saIzc4uUgJa_fj086O7Y6QFK8Zg-7A,12419
106
- schemathesis/openapi/loaders.py,sha256=1jh4Me2dngWalBmX5xjfln90tfbH-afxmjsiY1BuUTE,10645
106
+ schemathesis/openapi/loaders.py,sha256=_ryiESCdh_XJZsjsU4QsDeeqHY6MbBiMP4dDpiQkm-o,10742
107
107
  schemathesis/openapi/generation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
108
108
  schemathesis/openapi/generation/filters.py,sha256=pY9cUZdL_kQK80Z2aylTOqqa12zmaYUlYC5BfYgeQMk,2395
109
109
  schemathesis/pytest/__init__.py,sha256=7W0q-Thcw03IAQfXE_Mo8JPZpUdHJzfu85fjK1ZdfQM,88
@@ -153,12 +153,12 @@ schemathesis/specs/openapi/stateful/control.py,sha256=QaXLSbwQWtai5lxvvVtQV3BLJ8
153
153
  schemathesis/specs/openapi/stateful/links.py,sha256=h5q40jUbcIk5DS_Tih1cvFJxS_QxxG0_9ZQnTs1A_zo,8806
154
154
  schemathesis/transport/__init__.py,sha256=6yg_RfV_9L0cpA6qpbH-SL9_3ggtHQji9CZrpIkbA6s,5321
155
155
  schemathesis/transport/asgi.py,sha256=qTClt6oT_xUEWnRHokACN_uqCNNUZrRPT6YG0PjbElY,926
156
- schemathesis/transport/prepare.py,sha256=iiB8KTAqnnuqjWzblIPiGVdkGIF7Yr1SAEz-KZzBNXw,4581
156
+ schemathesis/transport/prepare.py,sha256=erYXRaxpQokIDzaIuvt_csHcw72iHfCyNq8VNEzXd0o,4743
157
157
  schemathesis/transport/requests.py,sha256=rziZTrZCVMAqgy6ldB8iTwhkpAsnjKSgK8hj5Sq3ThE,10656
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.11.dist-info/METADATA,sha256=ee1q1ZJgd2YpYahYSfaxUBU3QsKNqZWDhWuSv_gxmGg,8472
161
- schemathesis-4.0.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
162
- schemathesis-4.0.11.dist-info/entry_points.txt,sha256=hiK3un-xfgPdwj9uj16YVDtTNpO128bmk0U82SMv8ZQ,152
163
- schemathesis-4.0.11.dist-info/licenses/LICENSE,sha256=2Ve4J8v5jMQAWrT7r1nf3bI8Vflk3rZVQefiF2zpxwg,1121
164
- schemathesis-4.0.11.dist-info/RECORD,,
160
+ schemathesis-4.0.13.dist-info/METADATA,sha256=2E4DqYcjnW29smDSYVi-vCZVU_oFIYqvRGVZgHOAniw,8472
161
+ schemathesis-4.0.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
162
+ schemathesis-4.0.13.dist-info/entry_points.txt,sha256=hiK3un-xfgPdwj9uj16YVDtTNpO128bmk0U82SMv8ZQ,152
163
+ schemathesis-4.0.13.dist-info/licenses/LICENSE,sha256=2Ve4J8v5jMQAWrT7r1nf3bI8Vflk3rZVQefiF2zpxwg,1121
164
+ schemathesis-4.0.13.dist-info/RECORD,,