schemathesis 3.26.1__py3-none-any.whl → 3.26.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.
@@ -16,3 +16,6 @@ IS_PYTEST_ABOVE_8 = PYTEST_VERSION >= version.parse("8.0.0")
16
16
 
17
17
  HYPOTHESIS_VERSION = version.parse(metadata.version("hypothesis"))
18
18
  HYPOTHESIS_HAS_STATEFUL_NAMING_IMPROVEMENTS = HYPOTHESIS_VERSION >= version.parse("6.98.14")
19
+
20
+ PYRATE_LIMITER_VERSION = version.parse(metadata.version("pyrate-limiter"))
21
+ IS_PYRATE_LIMITER_ABOVE_3 = PYRATE_LIMITER_VERSION >= version.parse("3.0")
@@ -0,0 +1,6 @@
1
+ from ._dependency_versions import IS_PYRATE_LIMITER_ABOVE_3
2
+
3
+ if IS_PYRATE_LIMITER_ABOVE_3:
4
+ from pyrate_limiter import Limiter, Rate, RateItem
5
+ else:
6
+ from pyrate_limiter import Limiter, RequestRate as Rate
schemathesis/schemas.py CHANGED
@@ -40,6 +40,7 @@ from .generation import (
40
40
  DataGenerationMethodInput,
41
41
  GenerationConfig,
42
42
  )
43
+ from ._dependency_versions import IS_PYRATE_LIMITER_ABOVE_3
43
44
  from .exceptions import OperationSchemaError, UsageError
44
45
  from .hooks import HookContext, HookDispatcher, HookScope, dispatch
45
46
  from .internal.result import Result, Ok
@@ -423,7 +424,10 @@ class BaseSchema(Mapping):
423
424
  """Limit the rate of sending generated requests."""
424
425
  label = urlparse(self.base_url).netloc
425
426
  if self.rate_limiter is not None:
426
- return self.rate_limiter.ratelimit(label, delay=True, max_delay=0)
427
+ if IS_PYRATE_LIMITER_ABOVE_3:
428
+ self.rate_limiter.try_acquire(label)
429
+ else:
430
+ return self.rate_limiter.ratelimit(label, delay=True, max_delay=0)
427
431
  return nullcontext()
428
432
 
429
433
  def _get_payload_schema(self, definition: dict[str, Any], media_type: str) -> dict[str, Any] | None:
@@ -43,7 +43,9 @@ StrategyFactory = Callable[[Dict[str, Any], str, str, Optional[str], GenerationC
43
43
 
44
44
 
45
45
  def header_values(blacklist_characters: str = "\n\r") -> st.SearchStrategy[str]:
46
- return st.text(alphabet=st.characters(min_codepoint=0, max_codepoint=255, blacklist_characters="\n\r"))
46
+ return st.text(
47
+ alphabet=st.characters(min_codepoint=0, max_codepoint=255, blacklist_characters=blacklist_characters)
48
+ )
47
49
 
48
50
 
49
51
  @lru_cache
@@ -34,8 +34,8 @@ def invalid_rate(value: str) -> UsageError:
34
34
 
35
35
 
36
36
  def build_limiter(rate: str) -> Limiter:
37
- from pyrate_limiter import Limiter, RequestRate
37
+ from ._rate_limiter import Limiter, Rate
38
38
 
39
39
  limit, interval = parse_units(rate)
40
- rate = RequestRate(limit, interval)
40
+ rate = Rate(limit, interval)
41
41
  return Limiter(rate)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: schemathesis
3
- Version: 3.26.1
3
+ Version: 3.26.2
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
@@ -39,7 +39,7 @@ Requires-Dist: hypothesis<7,>=6.84.3; python_version > '3.8'
39
39
  Requires-Dist: hypothesis[zoneinfo]<7,>=6.84.3; python_version == '3.8'
40
40
  Requires-Dist: jsonschema<5.0,>=4.18.0
41
41
  Requires-Dist: junit-xml<2.0,>=1.9
42
- Requires-Dist: pyrate-limiter<3.0,>=2.10
42
+ Requires-Dist: pyrate-limiter<4.0,>=2.10
43
43
  Requires-Dist: pytest-subtests<0.8.0,>=0.2.1
44
44
  Requires-Dist: pytest<9,>=4.6.4
45
45
  Requires-Dist: pyyaml<7.0,>=5.1
@@ -1,9 +1,10 @@
1
1
  schemathesis/__init__.py,sha256=WW1NBZxmc5jRR0c24xz-ZtTkJMUQG5MOw1MGVRRGc1s,1970
2
2
  schemathesis/_compat.py,sha256=VizWR0QAVj4l7WZautNe_zmo3AJ7WBl2zrJQOfJAQtk,1837
3
- schemathesis/_dependency_versions.py,sha256=sLlY3jGtnjIg2JRMbVt89lYKiD3K2zl1A5QF0_5_O08,728
3
+ schemathesis/_dependency_versions.py,sha256=InIv6MZmuRVHc_9FxAiRg7_dY-vuF0jT69FBxrBLK6U,879
4
4
  schemathesis/_hypothesis.py,sha256=O3rfMbT0rChFONMUsYmMEGV9nPG5cHd_6v9NhWDI_IQ,10763
5
5
  schemathesis/_lazy_import.py,sha256=LTki2tM168fCcXet1e6qDoQq8SLgInUA3xjXgi7cXJk,469
6
6
  schemathesis/_override.py,sha256=oetGCvMGqP8plf2Suvql2E0n3P-PU9SIySKwlBjzuR4,1629
7
+ schemathesis/_rate_limiter.py,sha256=t0uUB4kz5lG1ogfLHwIImunOaP88jFkCf-zzzxOM3cs,212
7
8
  schemathesis/_xml.py,sha256=5AMZuno3fS4YWPqBlrv5V-f-BmawkdwmpD3GpAsaxnA,6922
8
9
  schemathesis/auths.py,sha256=tUuaHvXO96HJr22Gu9OmlSpL2wbAqKZr3TRbb9dVyA4,14732
9
10
  schemathesis/checks.py,sha256=SYts1Teecg-5kSHBo32Pzhh7YQ4a1Y7DIfldd-0VTj8,2155
@@ -20,10 +21,10 @@ schemathesis/models.py,sha256=Rcgm2VX7oQN3HN-ThZlqWmBuNsV1Hrd2_xbvh0K6KQY,46883
20
21
  schemathesis/parameters.py,sha256=VheEffVzoSfYaSEcG7KhPlA4ypifosG8biiHifzwL8g,2257
21
22
  schemathesis/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
23
  schemathesis/sanitization.py,sha256=WSV_MB5YRrYkp1pQRPHrzsidqsKcqYZiq64N9grKobo,8956
23
- schemathesis/schemas.py,sha256=rtlbHoEmZt5sF31E7Mn_MJdfcaCRUejVAkxFicrq3c0,18252
24
+ schemathesis/schemas.py,sha256=H13rs5X-FkNcGIB9W__oolu-AM-vIyYEiArXpg-rKU0,18429
24
25
  schemathesis/serializers.py,sha256=_xoebWkVrgbGbPjPgTgwuN-fN4YT004aj7kImyPComY,11619
25
26
  schemathesis/targets.py,sha256=tzp7VZ2-7g2nZHCooRgFzTMtOVcbl0rvtNR421hQthA,1162
26
- schemathesis/throttling.py,sha256=QQcS7TFpXHavUjm0kdFaCcCRhAGlgQ4y3XIbkdRoW20,1079
27
+ schemathesis/throttling.py,sha256=uwhL4XWPWAU8HECg0NhibfCMn5dT7NElTx3fdL3Mmcc,1065
27
28
  schemathesis/types.py,sha256=AglR5M0bce-YXeDRkweToXTP0GjNOWVjS_mIsxLobwc,919
28
29
  schemathesis/utils.py,sha256=4HXvHysnHp-Uz2HfNgLfW5F5VjL-mtixrjjzRCEJhYo,5233
29
30
  schemathesis/cli/__init__.py,sha256=MSdz9Xt2qvey-3HbWj5nfwV2nZ-rdV05u_Eh_Be9m0c,64909
@@ -92,7 +93,7 @@ schemathesis/specs/graphql/scalars.py,sha256=W5oj6AcjiXpR-Z6eSSp1oPWl0mjH2NF-w87
92
93
  schemathesis/specs/graphql/schemas.py,sha256=XK-zbR_d8zER2HLU3zH-BrKnfoV9hb0VXvDueryp8Y0,14091
93
94
  schemathesis/specs/graphql/validation.py,sha256=SqQbj9uymGUQxlHXc8HkQccIq25uwP5CvLF1zReb1Xg,1636
94
95
  schemathesis/specs/openapi/__init__.py,sha256=HDcx3bqpa6qWPpyMrxAbM3uTo0Lqpg-BUNZhDJSJKnw,279
95
- schemathesis/specs/openapi/_hypothesis.py,sha256=VPjIiGgsVBMffcCxHpaHFxpgjI2hq180Hpcsub46UC8,22807
96
+ schemathesis/specs/openapi/_hypothesis.py,sha256=o1ssS7JJZ45l750ogoZ3gXoedzLmRsXqpPb1LCZXikY,22835
96
97
  schemathesis/specs/openapi/checks.py,sha256=1WB_UGNqptfJThWLUNbds1Q-IzOGbbHCOYPIhBYk-zs,5411
97
98
  schemathesis/specs/openapi/constants.py,sha256=JqM_FHOenqS_MuUE9sxVQ8Hnw0DNM8cnKDwCwPLhID4,783
98
99
  schemathesis/specs/openapi/converter.py,sha256=9TKeKvNi9MVvoNMfqoPz_cODO8oNrMSTXTOwLLfjD_Q,2799
@@ -129,8 +130,8 @@ schemathesis/transports/auth.py,sha256=ZKFku9gjhIG6445qNC2p_64Yt9Iz_4azbvja8AMpt
129
130
  schemathesis/transports/content_types.py,sha256=xU8RZWxz-CyWRqQTI2fGYQacB7KasoY7LL_bxPQdyPY,2144
130
131
  schemathesis/transports/headers.py,sha256=EDxpm8su0AuhyqZUkMex-OFZMAJN_5NHah7fDT2HDZE,989
131
132
  schemathesis/transports/responses.py,sha256=U6z1VW5w19c9qRRoyf2ljkuXR2smTfWikmrTGqlgl18,1619
132
- schemathesis-3.26.1.dist-info/METADATA,sha256=UjWFZfyYDSYLiD8diepu3d2yF9mZSU36rJ6FrHdNtqU,16257
133
- schemathesis-3.26.1.dist-info/WHEEL,sha256=hKi7AIIx6qfnsRbr087vpeJnrVUuDokDHZacPPMW7-Y,87
134
- schemathesis-3.26.1.dist-info/entry_points.txt,sha256=VHyLcOG7co0nOeuk8WjgpRETk5P1E2iCLrn26Zkn5uk,158
135
- schemathesis-3.26.1.dist-info/licenses/LICENSE,sha256=PsPYgrDhZ7g9uwihJXNG-XVb55wj2uYhkl2DD8oAzY0,1103
136
- schemathesis-3.26.1.dist-info/RECORD,,
133
+ schemathesis-3.26.2.dist-info/METADATA,sha256=6ILqISo9c7aYKJCwsxMgNop39oJl1ZPz2qtbhLD_1nc,16257
134
+ schemathesis-3.26.2.dist-info/WHEEL,sha256=hKi7AIIx6qfnsRbr087vpeJnrVUuDokDHZacPPMW7-Y,87
135
+ schemathesis-3.26.2.dist-info/entry_points.txt,sha256=VHyLcOG7co0nOeuk8WjgpRETk5P1E2iCLrn26Zkn5uk,158
136
+ schemathesis-3.26.2.dist-info/licenses/LICENSE,sha256=PsPYgrDhZ7g9uwihJXNG-XVb55wj2uYhkl2DD8oAzY0,1103
137
+ schemathesis-3.26.2.dist-info/RECORD,,