Mercurial > p > roundup > code
changeset 8215:1b15f635ada1
fix(web) issue2551382 - handle crash in request call in test
due to invalid utf8 with surrogate. Ci reports this failure in the
requests call from the test case:
> string = string.encode(encoding, errors)
E UnicodeEncodeError: 'utf-8' codec can't encode character
'\ud800' in position 48: surrogates not allowed
E Falsifying example:
test_class_url_param_accepting_integer_values(
E self=<test.test_liveserver.FuzzGetUrls
testMethod=test_class_url_param_accepting_integer_values>,
E param='@verbose', # or any other generated value
E value='\ud800',
E )
E Explanation:
E These lines were always and only run by failing
examples:
E
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/site-packages/requests/utils.py:675
E
E You can reproduce this example by temporarily adding
@reproduce_failure('6.122.3', b'AAAAAQDXAA==') as a decorator on your
test case
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 16 Dec 2024 19:19:07 -0500 |
| parents | 55b0abde56ab |
| children | 03020f08a685 |
| files | test/test_liveserver.py |
| diffstat | 1 files changed, 3 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/test/test_liveserver.py Sun Dec 15 02:34:57 2024 -0500 +++ b/test/test_liveserver.py Mon Dec 16 19:19:07 2024 -0500 @@ -25,7 +25,7 @@ skip_hypothesis = lambda func, *args, **kwargs: func # ruff: noqa: E402 - from hypothesis import example, given, settings + from hypothesis import example, given, reproduce_failure, settings from hypothesis.strategies import binary, characters, emails, none, one_of, sampled_from, text except ImportError: @@ -46,7 +46,7 @@ pass # define the decorator functions - example = given = settings = noop_decorators_with_args + example = given = reproduce_failure = settings = noop_decorators_with_args # and stratgies using in decorators binary = characters = emails, none = one_of = sampled_from = text = noop_strategy @@ -237,8 +237,7 @@ # invalid value for param self.assertEqual(f.status_code, 400) - @given(sampled_from(['@verbose']), - one_of(characters(),text(min_size=1))) + @given(sampled_from(['@verbose']), text(min_size=1)) @example("@verbose", "1#") @settings(max_examples=_max_examples, deadline=10000) # 10000ms
