schemathesis 3.30.2__py3-none-any.whl → 3.30.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.
@@ -59,8 +59,6 @@ class ExecutionContext:
59
59
  probes: list[ProbeRun] | None = None
60
60
  analysis: Result[AnalysisResult, Exception] | None = None
61
61
  output_config: OutputConfig = field(default_factory=OutputConfig)
62
- # Special flag to display a warning about Windows-specific encoding issue
63
- encountered_windows_encoding_issue: bool = False
64
62
  state_machine_sink: StateMachineSink | None = None
65
63
 
66
64
  @deprecated_property(removed_in="4.0", replacement="show_trace")
@@ -46,6 +46,7 @@ if TYPE_CHECKING:
46
46
  import requests
47
47
 
48
48
  SPINNER_REPETITION_NUMBER = 10
49
+ IO_ENCODING = os.getenv("PYTHONIOENCODING", "utf-8")
49
50
 
50
51
 
51
52
  def get_terminal_width() -> int:
@@ -280,6 +281,18 @@ def display_failures(context: ExecutionContext, event: events.Finished) -> None:
280
281
  display_failures_for_single_test(context, result)
281
282
 
282
283
 
284
+ if IO_ENCODING != "utf-8":
285
+
286
+ def _secho(text: str, **kwargs: Any) -> None:
287
+ text = text.encode(IO_ENCODING, errors="replace").decode("utf-8")
288
+ click.secho(text, **kwargs)
289
+
290
+ else:
291
+
292
+ def _secho(text: str, **kwargs: Any) -> None:
293
+ click.secho(text, **kwargs)
294
+
295
+
283
296
  def display_failures_for_single_test(context: ExecutionContext, result: SerializedTestResult) -> None:
284
297
  """Display a failure for a single method / path."""
285
298
  from ...transports.responses import get_reason
@@ -298,7 +311,7 @@ def display_failures_for_single_test(context: ExecutionContext, result: Serializ
298
311
  click.secho(f"\n- {check.title}", fg="red", bold=True)
299
312
  message = check.formatted_message
300
313
  if message:
301
- click.secho(f"\n{message}", fg="red")
314
+ _secho(f"\n{message}", fg="red")
302
315
  if check_idx + 1 == len(checks):
303
316
  if check.response is not None:
304
317
  status_code = check.response.status_code
@@ -319,24 +332,7 @@ def display_failures_for_single_test(context: ExecutionContext, result: Serializ
319
332
  click.echo(payload)
320
333
  except UnicodeDecodeError:
321
334
  click.echo("\n <BINARY>")
322
-
323
- try:
324
- click.echo(
325
- f"\n{bold('Reproduce with')}: \n\n {code_sample}\n",
326
- )
327
- except UnicodeEncodeError:
328
- # On Windows it may fail when redirecting the output to a file
329
- # because it uses a different encoding than the console encoding and the default
330
- # is cp1252, which doesn't support some Unicode characters.
331
- # In this case, display a stub message and set a flag to display a warning at the end
332
- if platform.system() != "Windows":
333
- raise
334
- click.echo(
335
- f"\n{bold('Reproduce with')}: \n\n"
336
- " CAN NOT DISPLAY THIS CODE SAMPLE DUE TO TERMINAL LIMITATIONS.\n"
337
- " SEE DETAILS AT THE END OF THE OUTPUT\n",
338
- )
339
- context.encountered_windows_encoding_issue = True
335
+ _secho(f"\n{bold('Reproduce with')}: \n\n {code_sample}\n")
340
336
 
341
337
 
342
338
  def display_application_logs(context: ExecutionContext, event: events.Finished) -> None:
@@ -485,17 +481,6 @@ def display_statistic(context: ExecutionContext, event: events.Finished) -> None
485
481
  seed_option = f"`--hypothesis-seed={context.seed}`"
486
482
  click.secho(f"\n{bold('Note')}: To replicate these test failures, rerun with {bold(seed_option)}")
487
483
 
488
- if context.encountered_windows_encoding_issue:
489
- click.echo()
490
- title = click.style("WARNING:", bold=True, fg="yellow")
491
- name = click.style("PYTHONIOENCODING", bold=True)
492
- value = click.style("utf8", bold=True)
493
- warning = (
494
- "Some code samples could not be displayed due to terminal limitations on Windows.\n"
495
- f"To resolve this set the '{name}' environment variable to '{value}' and rerun your command."
496
- )
497
- click.secho(f"{title} {warning}")
498
-
499
484
  if context.report is not None and not context.is_interrupted:
500
485
  if isinstance(context.report, FileReportContext):
501
486
  click.echo()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: schemathesis
3
- Version: 3.30.2
3
+ Version: 3.30.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
@@ -32,7 +32,7 @@ schemathesis/cli/__main__.py,sha256=MWaenjaUTZIfNPFzKmnkTiawUri7DVldtg3mirLwzU8,
32
32
  schemathesis/cli/callbacks.py,sha256=tZSe6EIyc1fdKZ8xGaE0w0LuGCMtT7m9cW41Rd0Nah0,14949
33
33
  schemathesis/cli/cassettes.py,sha256=WLt2svZm23vZX5buQWmWO94QwQEC8OM2g8yH50rfatE,12990
34
34
  schemathesis/cli/constants.py,sha256=ogSuZs68KvzHNKF0yaiBkxLcGbo8IVR3xaIfsy1H1IQ,1546
35
- schemathesis/cli/context.py,sha256=BsaKvfmh9LmiDU3D7wixSzBjk9KWNRWJwYA3Xa3d35I,2223
35
+ schemathesis/cli/context.py,sha256=EMeyAbU9mRujR46anc43yr6ab4rGYtIDaHC3cV9Qa-Q,2092
36
36
  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
@@ -40,7 +40,7 @@ schemathesis/cli/options.py,sha256=DY5PUzpUNyYgpcqqFTeZjmVUykpbaI9fbN44QIWNOfA,2
40
40
  schemathesis/cli/reporting.py,sha256=AT8ZjSUeH0S9Dl1ZhvTw0CJPy1JdIIRuRWxsJXfFpjc,3521
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
- schemathesis/cli/output/default.py,sha256=0zFolpo2HS2NH-IzRqEIZqfa_6Vk4jEHpfykLQ7apAM,39755
43
+ schemathesis/cli/output/default.py,sha256=xG1R3f-s8xy-eqH42kL_ZSaADLkc6Fc0WqmcDbQTVVo,38775
44
44
  schemathesis/cli/output/short.py,sha256=CL6-Apxr5tuZ3BL1vecV1MiRY1wDt21g0wiUwZu6mLM,2607
45
45
  schemathesis/contrib/__init__.py,sha256=FH8NL8NXgSKBFOF8Jy_EB6T4CJEaiM-tmDhz16B2o4k,187
46
46
  schemathesis/contrib/unique_data.py,sha256=_ElPRLNp0XhdETiZ-aplKln4hgU04jxR17kmjAEWf1I,1318
@@ -144,8 +144,8 @@ schemathesis/transports/auth.py,sha256=4z7c-K7lfyyVqgR6X1v4yiE8ewR_ViAznWFTAsCL0
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.30.2.dist-info/METADATA,sha256=bwU4BSQbhEek_Gp8WnUrOR2rdShENNB3nVlQuKQ_O6g,17671
148
- schemathesis-3.30.2.dist-info/WHEEL,sha256=hKi7AIIx6qfnsRbr087vpeJnrVUuDokDHZacPPMW7-Y,87
149
- schemathesis-3.30.2.dist-info/entry_points.txt,sha256=VHyLcOG7co0nOeuk8WjgpRETk5P1E2iCLrn26Zkn5uk,158
150
- schemathesis-3.30.2.dist-info/licenses/LICENSE,sha256=PsPYgrDhZ7g9uwihJXNG-XVb55wj2uYhkl2DD8oAzY0,1103
151
- schemathesis-3.30.2.dist-info/RECORD,,
147
+ schemathesis-3.30.3.dist-info/METADATA,sha256=EJGm-5rC8P8sk_GgBDOfehfb5MdK4a9O6pU7jISsbTU,17671
148
+ schemathesis-3.30.3.dist-info/WHEEL,sha256=hKi7AIIx6qfnsRbr087vpeJnrVUuDokDHZacPPMW7-Y,87
149
+ schemathesis-3.30.3.dist-info/entry_points.txt,sha256=VHyLcOG7co0nOeuk8WjgpRETk5P1E2iCLrn26Zkn5uk,158
150
+ schemathesis-3.30.3.dist-info/licenses/LICENSE,sha256=PsPYgrDhZ7g9uwihJXNG-XVb55wj2uYhkl2DD8oAzY0,1103
151
+ schemathesis-3.30.3.dist-info/RECORD,,