self = <hypothesis.core.StateForActualGivenExecution object at 0x7fdb32476eb8>
def run_engine(self):
"""Run the test function many times, on database input and generated
input, using the Conjecture engine.
"""
# Tell pytest to omit the body of this function from tracebacks
__tracebackhide__ = True
try:
database_key = self.wrapped_test._hypothesis_internal_database_key
except AttributeError:
if global_force_seed is None:
database_key = function_digest(self.test)
else:
database_key = None
runner = ConjectureRunner(
self._execute_once_for_engine,
settings=self.settings,
random=self.random,
database_key=database_key,
)
# Use the Conjecture engine to run the test function many times
# on different inputs.
runner.run()
note_statistics(runner.statistics)
if runner.call_count == 0:
return
if runner.interesting_examples:
self.falsifying_examples = sorted(
runner.interesting_examples.values(),
key=lambda d: sort_key(d.buffer),
reverse=True,
)
else:
if runner.valid_examples == 0:
raise Unsatisfiable(
"Unable to satisfy assumptions of hypothesis %s."
% (get_pretty_function_description(self.test),)
)
if not self.falsifying_examples:
return
elif not self.settings.report_multiple_bugs:
# Pretend that we only found one failure, by discarding the others.
del self.falsifying_examples[:-1]
# The engine found one or more failures, so we need to reproduce and
# report them.
self.failed_normally = True
flaky = 0
if runner.best_observed_targets:
for line in describe_targets(runner.best_observed_targets):
report(line)
report("")
for falsifying_example in self.falsifying_examples:
info = falsifying_example.extra_information
ran_example = ConjectureData.for_buffer(falsifying_example.buffer)
self.__was_flaky = False
assert info.__expected_exception is not None
try:
self.execute_once(
ran_example,
print_example=not self.is_find,
is_final=True,
expected_failure=(
info.__expected_exception,
> info.__expected_traceback,
),
)
.tox/py3/lib/python3.7/site-packages/hypothesis/core.py:799:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <hypothesis.core.StateForActualGivenExecution object at 0x7fdb32476eb8>
data = ConjectureData(OVERRUN, 8 bytes, frozen), print_example = True
is_final = True
expected_failure = (AssertionError('Traceback (most recent call last):\n File "/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py...pshot_get_branches() takes from 2 to 5 positional arguments but 6 were given\n \nassert 500 == 200\n +500\n -200\n')
def execute_once(
self, data, print_example=False, is_final=False, expected_failure=None
):
"""Run the test function once, using ``data`` as input.
If the test raises an exception, it will propagate through to the
caller of this method. Depending on its type, this could represent
an ordinary test failure, or a fatal error, or a control exception.
If this method returns normally, the test might have passed, or
it might have placed ``data`` in an unsuccessful state and then
swallowed the corresponding control exception.
"""
data.is_find = self.is_find
text_repr = [None]
if self.settings.deadline is None:
test = self.test
else:
@proxies(self.test)
def test(*args, **kwargs):
self.__test_runtime = None
initial_draws = len(data.draw_times)
start = time.perf_counter()
result = self.test(*args, **kwargs)
finish = time.perf_counter()
internal_draw_time = sum(data.draw_times[initial_draws:])
runtime = datetime.timedelta(
seconds=finish - start - internal_draw_time
)
self.__test_runtime = runtime
current_deadline = self.settings.deadline
if not is_final:
current_deadline = (current_deadline // 4) * 5
if runtime >= current_deadline:
raise DeadlineExceeded(runtime, self.settings.deadline)
return result
def run(data):
# Set up dynamic context needed by a single test run.
with local_settings(self.settings):
with deterministic_PRNG():
with BuildContext(data, is_final=is_final):
# Generate all arguments to the test function.
args, kwargs = data.draw(self.search_strategy)
if expected_failure is not None:
text_repr[0] = arg_string(test, args, kwargs)
if print_example or current_verbosity() >= Verbosity.verbose:
output = StringIO()
printer = RepresentationPrinter(output)
if print_example:
printer.text("Falsifying example:")
else:
printer.text("Trying example:")
if self.print_given_args:
printer.text(" ")
printer.text(test.__name__)
with printer.group(indent=4, open="(", close=""):
printer.break_()
for v in args:
printer.pretty(v)
# We add a comma unconditionally because
# generated arguments will always be
# kwargs, so there will always be more
# to come.
printer.text(",")
printer.breakable()
# We need to make sure to print these in the
# argument order for Python 2 and older versions
# of Python 3.5. In modern versions this isn't
# an issue because kwargs is ordered.
arg_order = {
v: i
for i, v in enumerate(
getfullargspec(self.test).args
)
}
for i, (k, v) in enumerate(
sorted(
kwargs.items(),
key=lambda t: (
arg_order.get(t[0], float("inf")),
t[0],
),
)
):
printer.text(k)
printer.text("=")
printer.pretty(v)
printer.text(",")
if i + 1 < len(kwargs):
printer.breakable()
printer.break_()
printer.text(")")
printer.flush()
report(output.getvalue())
return test(*args, **kwargs)
# Run the test function once, via the executor hook.
# In most cases this will delegate straight to `run(data)`.
> result = self.test_runner(data, run)
.tox/py3/lib/python3.7/site-packages/hypothesis/core.py:629:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
data = ConjectureData(OVERRUN, 8 bytes, frozen)
function = <function StateForActualGivenExecution.execute_once.<locals>.run at 0x7fdb30b53ea0>
def default_new_style_executor(data, function):
> return function(data)
.tox/py3/lib/python3.7/site-packages/hypothesis/executors.py:52:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def run(data):
# Set up dynamic context needed by a single test run.
with local_settings(self.settings):
with deterministic_PRNG():
with BuildContext(data, is_final=is_final):
# Generate all arguments to the test function.
> args, kwargs = data.draw(self.search_strategy)
.tox/py3/lib/python3.7/site-packages/hypothesis/core.py:569:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
strategy = WithRunner(TupleStrategy((just(()), fixed_dictionaries({'new_origin': builds(dict, url=urls()).map(from_dict).filter(l...])[0] is None)}).map(lambda args: dict(args, **kwargs)))), runner=<django.test.client.Client object at 0x7fdb313d70b8>)
label = 12316132609319002662
def draw(self, strategy, label=None):
if self.is_find and not strategy.supports_find:
raise InvalidArgument(
(
"Cannot use strategy %r within a call to find (presumably "
"because it would be invalid after the call had ended)."
)
% (strategy,)
)
at_top_level = self.depth == 0
if at_top_level:
# We start this timer early, because accessing attributes on a LazyStrategy
# can be almost arbitrarily slow. In cases like characters() and text()
# where we cache something expensive, this led to Flaky deadline errors!
# See https://github.com/HypothesisWorks/hypothesis/issues/2108
start_time = time.perf_counter()
strategy.validate()
if strategy.is_empty:
self.mark_invalid()
if self.depth >= MAX_DEPTH:
self.mark_invalid()
if label is None:
label = strategy.label
self.start_example(label=label)
try:
if not at_top_level:
return strategy.do_draw(self)
else:
strategy.validate()
try:
> return strategy.do_draw(self)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:887:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = WithRunner(TupleStrategy((just(()), fixed_dictionaries({'new_origin': builds(dict, url=urls()).map(from_dict).filter(l...])[0] is None)}).map(lambda args: dict(args, **kwargs)))), runner=<django.test.client.Client object at 0x7fdb313d70b8>)
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data):
data.hypothesis_runner = self.runner
> return self.mapped_strategy.do_draw(data)
.tox/py3/lib/python3.7/site-packages/hypothesis/core.py:218:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = TupleStrategy((just(()), fixed_dictionaries({'new_origin': builds(dict, url=urls()).map(from_dict).filter(lambda origin: get_tests_data()["storage"].origin_get([origin.url])[0] is None)}).map(lambda args: dict(args, **kwargs))))
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data):
> return tuple(data.draw(e) for e in self.element_strategies)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/collections.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.0 = <tuple_iterator object at 0x7fdb30b46f28>
> return tuple(data.draw(e) for e in self.element_strategies)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/collections.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
strategy = fixed_dictionaries({'new_origin': builds(dict, url=urls()).map(from_dict).filter(lambda origin: get_tests_data()["storage"].origin_get([origin.url])[0] is None)}).map(lambda args: dict(args, **kwargs))
label = 10700208128082112041
def draw(self, strategy, label=None):
if self.is_find and not strategy.supports_find:
raise InvalidArgument(
(
"Cannot use strategy %r within a call to find (presumably "
"because it would be invalid after the call had ended)."
)
% (strategy,)
)
at_top_level = self.depth == 0
if at_top_level:
# We start this timer early, because accessing attributes on a LazyStrategy
# can be almost arbitrarily slow. In cases like characters() and text()
# where we cache something expensive, this led to Flaky deadline errors!
# See https://github.com/HypothesisWorks/hypothesis/issues/2108
start_time = time.perf_counter()
strategy.validate()
if strategy.is_empty:
self.mark_invalid()
if self.depth >= MAX_DEPTH:
self.mark_invalid()
if label is None:
label = strategy.label
self.start_example(label=label)
try:
if not at_top_level:
> return strategy.do_draw(self)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = fixed_dictionaries({'new_origin': builds(dict, url=urls()).map(from_dict).filter(lambda origin: get_tests_data()["storage"].origin_get([origin.url])[0] is None)}).map(lambda args: dict(args, **kwargs))
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data: ConjectureData) -> Ex:
for _ in range(3):
i = data.index
try:
data.start_example(MAPPED_SEARCH_STRATEGY_DO_DRAW_LABEL)
> result = self.pack(data.draw(self.mapped_strategy))
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/strategies.py:650:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
strategy = fixed_dictionaries({'new_origin': builds(dict, url=urls()).map(from_dict).filter(lambda origin: get_tests_data()["storage"].origin_get([origin.url])[0] is None)})
label = 12000696373305623442
def draw(self, strategy, label=None):
if self.is_find and not strategy.supports_find:
raise InvalidArgument(
(
"Cannot use strategy %r within a call to find (presumably "
"because it would be invalid after the call had ended)."
)
% (strategy,)
)
at_top_level = self.depth == 0
if at_top_level:
# We start this timer early, because accessing attributes on a LazyStrategy
# can be almost arbitrarily slow. In cases like characters() and text()
# where we cache something expensive, this led to Flaky deadline errors!
# See https://github.com/HypothesisWorks/hypothesis/issues/2108
start_time = time.perf_counter()
strategy.validate()
if strategy.is_empty:
self.mark_invalid()
if self.depth >= MAX_DEPTH:
self.mark_invalid()
if label is None:
label = strategy.label
self.start_example(label=label)
try:
if not at_top_level:
> return strategy.do_draw(self)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = fixed_dictionaries({'new_origin': builds(dict, url=urls()).map(from_dict).filter(lambda origin: get_tests_data()["storage"].origin_get([origin.url])[0] is None)})
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data):
> return data.draw(self.wrapped_strategy)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/lazy.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
strategy = FixedKeysDictStrategy(('new_origin',), TupleStrategy((builds(dict, url=urls()).map(from_dict).filter(lambda origin: get_tests_data()["storage"].origin_get([origin.url])[0] is None),)))
label = 12000696373305623442
def draw(self, strategy, label=None):
if self.is_find and not strategy.supports_find:
raise InvalidArgument(
(
"Cannot use strategy %r within a call to find (presumably "
"because it would be invalid after the call had ended)."
)
% (strategy,)
)
at_top_level = self.depth == 0
if at_top_level:
# We start this timer early, because accessing attributes on a LazyStrategy
# can be almost arbitrarily slow. In cases like characters() and text()
# where we cache something expensive, this led to Flaky deadline errors!
# See https://github.com/HypothesisWorks/hypothesis/issues/2108
start_time = time.perf_counter()
strategy.validate()
if strategy.is_empty:
self.mark_invalid()
if self.depth >= MAX_DEPTH:
self.mark_invalid()
if label is None:
label = strategy.label
self.start_example(label=label)
try:
if not at_top_level:
> return strategy.do_draw(self)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = FixedKeysDictStrategy(('new_origin',), TupleStrategy((builds(dict, url=urls()).map(from_dict).filter(lambda origin: get_tests_data()["storage"].origin_get([origin.url])[0] is None),)))
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data: ConjectureData) -> Ex:
for _ in range(3):
i = data.index
try:
data.start_example(MAPPED_SEARCH_STRATEGY_DO_DRAW_LABEL)
> result = self.pack(data.draw(self.mapped_strategy))
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/strategies.py:650:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
strategy = TupleStrategy((builds(dict, url=urls()).map(from_dict).filter(lambda origin: get_tests_data()["storage"].origin_get([origin.url])[0] is None),))
label = 14795672415743474082
def draw(self, strategy, label=None):
if self.is_find and not strategy.supports_find:
raise InvalidArgument(
(
"Cannot use strategy %r within a call to find (presumably "
"because it would be invalid after the call had ended)."
)
% (strategy,)
)
at_top_level = self.depth == 0
if at_top_level:
# We start this timer early, because accessing attributes on a LazyStrategy
# can be almost arbitrarily slow. In cases like characters() and text()
# where we cache something expensive, this led to Flaky deadline errors!
# See https://github.com/HypothesisWorks/hypothesis/issues/2108
start_time = time.perf_counter()
strategy.validate()
if strategy.is_empty:
self.mark_invalid()
if self.depth >= MAX_DEPTH:
self.mark_invalid()
if label is None:
label = strategy.label
self.start_example(label=label)
try:
if not at_top_level:
> return strategy.do_draw(self)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = TupleStrategy((builds(dict, url=urls()).map(from_dict).filter(lambda origin: get_tests_data()["storage"].origin_get([origin.url])[0] is None),))
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data):
> return tuple(data.draw(e) for e in self.element_strategies)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/collections.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.0 = <tuple_iterator object at 0x7fdb313382e8>
> return tuple(data.draw(e) for e in self.element_strategies)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/collections.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
strategy = builds(dict, url=urls()).map(from_dict).filter(lambda origin: get_tests_data()["storage"].origin_get([origin.url])[0] is None)
label = 10358930435738099914
def draw(self, strategy, label=None):
if self.is_find and not strategy.supports_find:
raise InvalidArgument(
(
"Cannot use strategy %r within a call to find (presumably "
"because it would be invalid after the call had ended)."
)
% (strategy,)
)
at_top_level = self.depth == 0
if at_top_level:
# We start this timer early, because accessing attributes on a LazyStrategy
# can be almost arbitrarily slow. In cases like characters() and text()
# where we cache something expensive, this led to Flaky deadline errors!
# See https://github.com/HypothesisWorks/hypothesis/issues/2108
start_time = time.perf_counter()
strategy.validate()
if strategy.is_empty:
self.mark_invalid()
if self.depth >= MAX_DEPTH:
self.mark_invalid()
if label is None:
label = strategy.label
self.start_example(label=label)
try:
if not at_top_level:
> return strategy.do_draw(self)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = builds(dict, url=urls()).map(from_dict).filter(lambda origin: get_tests_data()["storage"].origin_get([origin.url])[0] is None)
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data: ConjectureData) -> Ex:
result = self.filtered_strategy.do_filtered_draw(
> data=data, filter_strategy=self
)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/strategies.py:724:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = builds(dict, url=urls()).map(from_dict)
data = ConjectureData(OVERRUN, 8 bytes, frozen)
filter_strategy = builds(dict, url=urls()).map(from_dict).filter(lambda origin: get_tests_data()["storage"].origin_get([origin.url])[0] is None)
def do_filtered_draw(self, data, filter_strategy):
# Hook for strategies that want to override the behaviour of
# FilteredStrategy. Most strategies don't, so by default we delegate
# straight back to the default filtered-draw implementation.
> return filter_strategy.default_do_filtered_draw(data)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/strategies.py:352:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = builds(dict, url=urls()).map(from_dict).filter(lambda origin: get_tests_data()["storage"].origin_get([origin.url])[0] is None)
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def default_do_filtered_draw(self, data):
for i in range(3):
start_index = data.index
> value = data.draw(self.filtered_strategy)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/strategies.py:739:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
strategy = builds(dict, url=urls()).map(from_dict), label = 10700208128082112041
def draw(self, strategy, label=None):
if self.is_find and not strategy.supports_find:
raise InvalidArgument(
(
"Cannot use strategy %r within a call to find (presumably "
"because it would be invalid after the call had ended)."
)
% (strategy,)
)
at_top_level = self.depth == 0
if at_top_level:
# We start this timer early, because accessing attributes on a LazyStrategy
# can be almost arbitrarily slow. In cases like characters() and text()
# where we cache something expensive, this led to Flaky deadline errors!
# See https://github.com/HypothesisWorks/hypothesis/issues/2108
start_time = time.perf_counter()
strategy.validate()
if strategy.is_empty:
self.mark_invalid()
if self.depth >= MAX_DEPTH:
self.mark_invalid()
if label is None:
label = strategy.label
self.start_example(label=label)
try:
if not at_top_level:
> return strategy.do_draw(self)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = builds(dict, url=urls()).map(from_dict)
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data: ConjectureData) -> Ex:
for _ in range(3):
i = data.index
try:
data.start_example(MAPPED_SEARCH_STRATEGY_DO_DRAW_LABEL)
> result = self.pack(data.draw(self.mapped_strategy))
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/strategies.py:650:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
strategy = builds(dict, url=urls()), label = 10700208128082112041
def draw(self, strategy, label=None):
if self.is_find and not strategy.supports_find:
raise InvalidArgument(
(
"Cannot use strategy %r within a call to find (presumably "
"because it would be invalid after the call had ended)."
)
% (strategy,)
)
at_top_level = self.depth == 0
if at_top_level:
# We start this timer early, because accessing attributes on a LazyStrategy
# can be almost arbitrarily slow. In cases like characters() and text()
# where we cache something expensive, this led to Flaky deadline errors!
# See https://github.com/HypothesisWorks/hypothesis/issues/2108
start_time = time.perf_counter()
strategy.validate()
if strategy.is_empty:
self.mark_invalid()
if self.depth >= MAX_DEPTH:
self.mark_invalid()
if label is None:
label = strategy.label
self.start_example(label=label)
try:
if not at_top_level:
> return strategy.do_draw(self)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = builds(dict, url=urls()), data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data):
> return data.draw(self.wrapped_strategy)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/lazy.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
strategy = tuples(tuples(), fixed_dictionaries({'url': <hypothesis.strategies._internal.core.CompositeStrategy at 0x7fdb324762e8>})).map(lambda value: target(*value[0], **value[1]))
label = 10700208128082112041
def draw(self, strategy, label=None):
if self.is_find and not strategy.supports_find:
raise InvalidArgument(
(
"Cannot use strategy %r within a call to find (presumably "
"because it would be invalid after the call had ended)."
)
% (strategy,)
)
at_top_level = self.depth == 0
if at_top_level:
# We start this timer early, because accessing attributes on a LazyStrategy
# can be almost arbitrarily slow. In cases like characters() and text()
# where we cache something expensive, this led to Flaky deadline errors!
# See https://github.com/HypothesisWorks/hypothesis/issues/2108
start_time = time.perf_counter()
strategy.validate()
if strategy.is_empty:
self.mark_invalid()
if self.depth >= MAX_DEPTH:
self.mark_invalid()
if label is None:
label = strategy.label
self.start_example(label=label)
try:
if not at_top_level:
> return strategy.do_draw(self)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = tuples(tuples(), fixed_dictionaries({'url': <hypothesis.strategies._internal.core.CompositeStrategy at 0x7fdb324762e8>})).map(lambda value: target(*value[0], **value[1]))
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data: ConjectureData) -> Ex:
for _ in range(3):
i = data.index
try:
data.start_example(MAPPED_SEARCH_STRATEGY_DO_DRAW_LABEL)
> result = self.pack(data.draw(self.mapped_strategy))
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/strategies.py:650:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
strategy = tuples(tuples(), fixed_dictionaries({'url': <hypothesis.strategies._internal.core.CompositeStrategy at 0x7fdb324762e8>}))
label = 7003277541606287402
def draw(self, strategy, label=None):
if self.is_find and not strategy.supports_find:
raise InvalidArgument(
(
"Cannot use strategy %r within a call to find (presumably "
"because it would be invalid after the call had ended)."
)
% (strategy,)
)
at_top_level = self.depth == 0
if at_top_level:
# We start this timer early, because accessing attributes on a LazyStrategy
# can be almost arbitrarily slow. In cases like characters() and text()
# where we cache something expensive, this led to Flaky deadline errors!
# See https://github.com/HypothesisWorks/hypothesis/issues/2108
start_time = time.perf_counter()
strategy.validate()
if strategy.is_empty:
self.mark_invalid()
if self.depth >= MAX_DEPTH:
self.mark_invalid()
if label is None:
label = strategy.label
self.start_example(label=label)
try:
if not at_top_level:
> return strategy.do_draw(self)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = tuples(tuples(), fixed_dictionaries({'url': <hypothesis.strategies._internal.core.CompositeStrategy at 0x7fdb324762e8>}))
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data):
> return data.draw(self.wrapped_strategy)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/lazy.py:150:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
strategy = TupleStrategy((TupleStrategy(()), FixedKeysDictStrategy(('url',), TupleStrategy((<hypothesis.strategies._internal.core.CompositeStrategy object at 0x7fdb324762e8>,)))))
label = 7003277541606287402
def draw(self, strategy, label=None):
if self.is_find and not strategy.supports_find:
raise InvalidArgument(
(
"Cannot use strategy %r within a call to find (presumably "
"because it would be invalid after the call had ended)."
)
% (strategy,)
)
at_top_level = self.depth == 0
if at_top_level:
# We start this timer early, because accessing attributes on a LazyStrategy
# can be almost arbitrarily slow. In cases like characters() and text()
# where we cache something expensive, this led to Flaky deadline errors!
# See https://github.com/HypothesisWorks/hypothesis/issues/2108
start_time = time.perf_counter()
strategy.validate()
if strategy.is_empty:
self.mark_invalid()
if self.depth >= MAX_DEPTH:
self.mark_invalid()
if label is None:
label = strategy.label
self.start_example(label=label)
try:
if not at_top_level:
> return strategy.do_draw(self)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = TupleStrategy((TupleStrategy(()), FixedKeysDictStrategy(('url',), TupleStrategy((<hypothesis.strategies._internal.core.CompositeStrategy object at 0x7fdb324762e8>,)))))
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data):
> return tuple(data.draw(e) for e in self.element_strategies)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/collections.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.0 = <tuple_iterator object at 0x7fdb31338710>
> return tuple(data.draw(e) for e in self.element_strategies)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/collections.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
strategy = FixedKeysDictStrategy(('url',), TupleStrategy((<hypothesis.strategies._internal.core.CompositeStrategy object at 0x7fdb324762e8>,)))
label = 12000696373305623442
def draw(self, strategy, label=None):
if self.is_find and not strategy.supports_find:
raise InvalidArgument(
(
"Cannot use strategy %r within a call to find (presumably "
"because it would be invalid after the call had ended)."
)
% (strategy,)
)
at_top_level = self.depth == 0
if at_top_level:
# We start this timer early, because accessing attributes on a LazyStrategy
# can be almost arbitrarily slow. In cases like characters() and text()
# where we cache something expensive, this led to Flaky deadline errors!
# See https://github.com/HypothesisWorks/hypothesis/issues/2108
start_time = time.perf_counter()
strategy.validate()
if strategy.is_empty:
self.mark_invalid()
if self.depth >= MAX_DEPTH:
self.mark_invalid()
if label is None:
label = strategy.label
self.start_example(label=label)
try:
if not at_top_level:
> return strategy.do_draw(self)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = FixedKeysDictStrategy(('url',), TupleStrategy((<hypothesis.strategies._internal.core.CompositeStrategy object at 0x7fdb324762e8>,)))
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data: ConjectureData) -> Ex:
for _ in range(3):
i = data.index
try:
data.start_example(MAPPED_SEARCH_STRATEGY_DO_DRAW_LABEL)
> result = self.pack(data.draw(self.mapped_strategy))
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/strategies.py:650:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
strategy = TupleStrategy((<hypothesis.strategies._internal.core.CompositeStrategy object at 0x7fdb324762e8>,))
label = 6455009635651046262
def draw(self, strategy, label=None):
if self.is_find and not strategy.supports_find:
raise InvalidArgument(
(
"Cannot use strategy %r within a call to find (presumably "
"because it would be invalid after the call had ended)."
)
% (strategy,)
)
at_top_level = self.depth == 0
if at_top_level:
# We start this timer early, because accessing attributes on a LazyStrategy
# can be almost arbitrarily slow. In cases like characters() and text()
# where we cache something expensive, this led to Flaky deadline errors!
# See https://github.com/HypothesisWorks/hypothesis/issues/2108
start_time = time.perf_counter()
strategy.validate()
if strategy.is_empty:
self.mark_invalid()
if self.depth >= MAX_DEPTH:
self.mark_invalid()
if label is None:
label = strategy.label
self.start_example(label=label)
try:
if not at_top_level:
> return strategy.do_draw(self)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = TupleStrategy((<hypothesis.strategies._internal.core.CompositeStrategy object at 0x7fdb324762e8>,))
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data):
> return tuple(data.draw(e) for e in self.element_strategies)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/collections.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.0 = <tuple_iterator object at 0x7fdb31338048>
> return tuple(data.draw(e) for e in self.element_strategies)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/collections.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
strategy = <hypothesis.strategies._internal.core.CompositeStrategy object at 0x7fdb324762e8>
label = 1946211324807467550
def draw(self, strategy, label=None):
if self.is_find and not strategy.supports_find:
raise InvalidArgument(
(
"Cannot use strategy %r within a call to find (presumably "
"because it would be invalid after the call had ended)."
)
% (strategy,)
)
at_top_level = self.depth == 0
if at_top_level:
# We start this timer early, because accessing attributes on a LazyStrategy
# can be almost arbitrarily slow. In cases like characters() and text()
# where we cache something expensive, this led to Flaky deadline errors!
# See https://github.com/HypothesisWorks/hypothesis/issues/2108
start_time = time.perf_counter()
strategy.validate()
if strategy.is_empty:
self.mark_invalid()
if self.depth >= MAX_DEPTH:
self.mark_invalid()
if label is None:
label = strategy.label
self.start_example(label=label)
try:
if not at_top_level:
> return strategy.do_draw(self)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <hypothesis.strategies._internal.core.CompositeStrategy object at 0x7fdb324762e8>
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data):
> return self.definition(data.draw, *self.args, **self.kwargs)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/core.py:1809:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
draw = <bound method ConjectureData.draw of ConjectureData(OVERRUN, 8 bytes, frozen)>
@composite
def urls(draw):
> protocol = draw(sampled_from(["git", "http", "https", "deb"]))
.tox/py3/lib/python3.7/site-packages/swh/model/hypothesis_strategies.py:90:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
strategy = sampled_from(['git', 'http', 'https', 'deb'])
label = 2435039915453465539
def draw(self, strategy, label=None):
if self.is_find and not strategy.supports_find:
raise InvalidArgument(
(
"Cannot use strategy %r within a call to find (presumably "
"because it would be invalid after the call had ended)."
)
% (strategy,)
)
at_top_level = self.depth == 0
if at_top_level:
# We start this timer early, because accessing attributes on a LazyStrategy
# can be almost arbitrarily slow. In cases like characters() and text()
# where we cache something expensive, this led to Flaky deadline errors!
# See https://github.com/HypothesisWorks/hypothesis/issues/2108
start_time = time.perf_counter()
strategy.validate()
if strategy.is_empty:
self.mark_invalid()
if self.depth >= MAX_DEPTH:
self.mark_invalid()
if label is None:
label = strategy.label
self.start_example(label=label)
try:
if not at_top_level:
> return strategy.do_draw(self)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = sampled_from(['git', 'http', 'https', 'deb'])
data = ConjectureData(OVERRUN, 8 bytes, frozen)
def do_draw(self, data):
> return cu.choice(data, self.elements)
.tox/py3/lib/python3.7/site-packages/hypothesis/strategies/_internal/strategies.py:452:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
data = ConjectureData(OVERRUN, 8 bytes, frozen)
values = ('git', 'http', 'https', 'deb')
def choice(data, values):
> return values[integer_range(data, 0, len(values) - 1)]
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/utils.py:146:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
data = ConjectureData(OVERRUN, 8 bytes, frozen), lower = 0, upper = 3
center = 0
def integer_range(data, lower, upper, center=None):
assert lower <= upper
if lower == upper:
# Write a value even when this is trivial so that when a bound depends
# on other values we don't suddenly disappear when the gap shrinks to
# zero - if that happens then often the data stream becomes misaligned
# and we fail to shrink in cases where we really should be able to.
data.draw_bits(1, forced=0)
return int(lower)
if center is None:
center = lower
center = min(max(center, lower), upper)
if center == upper:
above = False
elif center == lower:
above = True
else:
above = boolean(data)
if above:
gap = upper - center
else:
gap = center - lower
assert gap > 0
bits = bit_length(gap)
probe = gap + 1
if bits > 24 and data.draw_bits(3):
# For large ranges, we combine the uniform random distribution from draw_bits
# with the weighting scheme used by WideRangeIntStrategy with moderate chance.
# Cutoff at 2 ** 24 so unicode choice is uniform but 32bit distribution is not.
idx = Sampler([4.0, 8.0, 1.0, 1.0, 0.5]).sample(data)
sizes = [8, 16, 32, 64, 128]
bits = min(bits, sizes[idx])
while probe > gap:
data.start_example(INTEGER_RANGE_DRAW_LABEL)
> probe = data.draw_bits(bits)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/utils.py:101:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen), n = 2
def draw_bits(self, n, *, forced=None):
"""Return an ``n``-bit integer from the underlying source of
bytes. If ``forced`` is set to an integer will instead
ignore the underlying source and simulate a draw as if it had
returned that integer."""
self.__assert_not_frozen("draw_bits")
if n == 0:
return 0
assert n > 0
n_bytes = bits_to_bytes(n)
> self.__check_capacity(n_bytes)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:991:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen), n = 1
def __check_capacity(self, n):
if self.index + n > self.max_length:
> self.mark_overrun()
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:1044:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen)
def mark_overrun(self):
> self.conclude_test(Status.OVERRUN)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:1061:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ConjectureData(OVERRUN, 8 bytes, frozen), status = Status.OVERRUN
interesting_origin = None
def conclude_test(self, status, interesting_origin=None):
assert (interesting_origin is None) or (status == Status.INTERESTING)
self.__assert_not_frozen("conclude_test")
self.interesting_origin = interesting_origin
self.status = status
self.freeze()
> raise StopTest(self.testcounter)
E hypothesis.errors.StopTest: 1740
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:1052: StopTest
During handling of the above exception, another exception occurred:
client = <django.test.client.Client object at 0x7fdb313d70b8>
archive_data = <swh.web.tests.conftest._ArchiveData object at 0x7fdb38489a20>
@given(new_origin())
> def test_origin_empty_snapshot_null_revision(client, archive_data, new_origin):
.tox/py3/lib/python3.7/site-packages/swh/web/tests/browse/views/test_origin.py:702:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <hypothesis.core.StateForActualGivenExecution object at 0x7fdb32476eb8>
message = 'Unreliable assumption: An example which satisfied assumptions on the first run now fails it.'
def __flaky(self, message):
if len(self.falsifying_examples) <= 1:
> raise Flaky(message)
E hypothesis.errors.Flaky: Unreliable assumption: An example which satisfied assumptions on the first run now fails it.
.tox/py3/lib/python3.7/site-packages/hypothesis/core.py:866: Flaky
TEST RESULT
TEST RESULT
- Run At
- Nov 26 2020, 6:22 PM