self = <hypothesis.core.StateForActualGivenExecution object at 0x7f5847b717b8>
data = ConjectureData(INTERESTING, 24 bytes, frozen)
def _execute_once_for_engine(self, data):
"""Wrapper around ``execute_once`` that intercepts test failure
exceptions and single-test control exceptions, and turns them into
appropriate method calls to `data` instead.
This allows the engine to assume that any exception other than
``StopTest`` must be a fatal error, and should stop the entire engine.
"""
try:
> result = self.execute_once(data)
.tox/py3/lib/python3.7/site-packages/hypothesis/core.py:656:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <hypothesis.core.StateForActualGivenExecution object at 0x7f5847b717b8>
data = ConjectureData(INTERESTING, 24 bytes, frozen), print_example = False
is_final = False, expected_failure = None
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 = perf_counter()
result = self.test(*args, **kwargs)
finish = 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 versionf 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:611:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
data = ConjectureData(INTERESTING, 24 bytes, frozen)
function = <function StateForActualGivenExecution.execute_once.<locals>.run at 0x7f584409c158>
def default_new_style_executor(data, function):
> return function(data)
.tox/py3/lib/python3.7/site-packages/hypothesis/executors.py:52:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
data = ConjectureData(INTERESTING, 24 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)
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 versionf 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)
.tox/py3/lib/python3.7/site-packages/hypothesis/core.py:607:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
swh_storage = <swh.storage.validate.ValidatingProxyStorage object at 0x7f5852b58400>
branch_name = b'\x00'
branch_target = SnapshotBranch(target=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', target_type=<TargetType.CONTENT: 'content'>)
@given(branch_name=branch_names(), branch_target=branch_targets(only_objects=True))
> def test_snapshot_large(swh_storage, branch_name, branch_target): # noqa
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/algos/test_snapshot.py:25:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = (<swh.storage.validate.ValidatingProxyStorage object at 0x7f5852b58400>, b'\x00', SnapshotBranch(target=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', target_type=<TargetType.CONTENT: 'content'>))
kwargs = {}, initial_draws = 1, start = 1637089.948691614
@proxies(self.test)
def test(*args, **kwargs):
self.__test_runtime = None
initial_draws = len(data.draw_times)
start = perf_counter()
> result = self.test(*args, **kwargs)
.tox/py3/lib/python3.7/site-packages/hypothesis/core.py:531:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
swh_storage = <swh.storage.validate.ValidatingProxyStorage object at 0x7f5852b58400>
branch_name = b'\x00'
branch_target = {'target': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'target_type': 'content'}
@given(branch_name=branch_names(), branch_target=branch_targets(only_objects=True))
def test_snapshot_large(swh_storage, branch_name, branch_target): # noqa
branch_target = branch_target.to_dict()
snapshot = {
"branches": {b"%s%05d" % (branch_name, i): branch_target for i in range(10000)}
}
snapshot["id"] = identifier_to_bytes(snapshot_identifier(snapshot))
> swh_storage.snapshot_add([snapshot])
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/algos/test_snapshot.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.validate.ValidatingProxyStorage object at 0x7f5852b58400>
snapshots = [Snapshot(branches={b'\x0000000': SnapshotBranch(target=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...x00\x00\x00', target_type=<TargetType.CONTENT: 'content'>)}, id=b'/2\xc2\x8fe\xe1s#\xfcp\x1c.\xda\xe8$X\xd8\x13[\xa8')]
def snapshot_add(self, snapshots: Iterable[Dict]) -> Dict:
with convert_validation_exceptions():
snapshots = [Snapshot.from_dict(s) for s in snapshots]
> return self.storage.snapshot_add(snapshots)
.tox/py3/lib/python3.7/site-packages/swh/storage/validate.py:90:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.in_memory.InMemoryStorage object at 0x7f5852b58438>
snapshots = <generator object InMemoryStorage.snapshot_add.<locals>.<genexpr> at 0x7f58508fe660>
def snapshot_add(self, snapshots: Iterable[Snapshot]) -> Dict:
count = 0
snapshots = (snap for snap in snapshots if snap.id not in self._snapshots)
for snapshot in snapshots:
> self.journal_writer.snapshot_add([snapshot])
.tox/py3/lib/python3.7/site-packages/swh/storage/in_memory.py:538:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.writer.JournalWriter object at 0x7f5852b52940>
snapshots = [Snapshot(branches={b'\x0000000': SnapshotBranch(target=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...x00\x00\x00', target_type=<TargetType.CONTENT: 'content'>)}, id=b'/2\xc2\x8fe\xe1s#\xfcp\x1c.\xda\xe8$X\xd8\x13[\xa8')]
def snapshot_add(self, snapshots: Iterable[Snapshot]) -> None:
> self.write_additions("snapshot", snapshots)
.tox/py3/lib/python3.7/site-packages/swh/storage/writer.py:77:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.storage.writer.JournalWriter object at 0x7f5852b52940>
obj_type = 'snapshot'
values = [Snapshot(branches={b'\x0000000': SnapshotBranch(target=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...x00\x00\x00', target_type=<TargetType.CONTENT: 'content'>)}, id=b'/2\xc2\x8fe\xe1s#\xfcp\x1c.\xda\xe8$X\xd8\x13[\xa8')]
def write_additions(self, obj_type, values) -> None:
if self.journal:
> self.journal.write_additions(obj_type, values)
.tox/py3/lib/python3.7/site-packages/swh/storage/writer.py:48:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.journal.writer.inmemory.InMemoryJournalWriter object at 0x7f5852b527b8>
object_type = 'snapshot'
objects = [Snapshot(branches={b'\x0000000': SnapshotBranch(target=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...x00\x00\x00', target_type=<TargetType.CONTENT: 'content'>)}, id=b'/2\xc2\x8fe\xe1s#\xfcp\x1c.\xda\xe8$X\xd8\x13[\xa8')]
def write_additions(self, object_type: str, objects: List[ModelObject]) -> None:
for object_ in objects:
> self.write_addition(object_type, object_)
.tox/py3/lib/python3.7/site-packages/swh/journal/writer/inmemory.py:32:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <swh.journal.writer.inmemory.InMemoryJournalWriter object at 0x7f5852b527b8>
object_type = 'snapshot'
object_ = Snapshot(branches={b'\x0000000': SnapshotBranch(target=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\...\x00\x00\x00', target_type=<TargetType.CONTENT: 'content'>)}, id=b'/2\xc2\x8fe\xe1s#\xfcp\x1c.\xda\xe8$X\xd8\x13[\xa8')
def write_addition(self, object_type: str, object_: ModelObject) -> None:
assert isinstance(object_, BaseModel)
> self.objects.append((object_type, object_))
.tox/py3/lib/python3.7/site-packages/swh/journal/writer/inmemory.py:26:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ListProxy object, typeid 'list' at 0x7f5852b52e80>
args = (('snapshot', Snapshot(branches={b'\x0000000': SnapshotBranch(target=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0...0\x00\x00', target_type=<TargetType.CONTENT: 'content'>)}, id=b'/2\xc2\x8fe\xe1s#\xfcp\x1c.\xda\xe8$X\xd8\x13[\xa8')),)
kwds = {}
> ???
<string>:2:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ListProxy object, typeid 'list' at 0x7f5852b52e80>
methodname = 'append'
args = (('snapshot', Snapshot(branches={b'\x0000000': SnapshotBranch(target=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0...0\x00\x00', target_type=<TargetType.CONTENT: 'content'>)}, id=b'/2\xc2\x8fe\xe1s#\xfcp\x1c.\xda\xe8$X\xd8\x13[\xa8')),)
kwds = {}
def _callmethod(self, methodname, args=(), kwds={}):
'''
Try to call a method of the referrent and return a copy of the result
'''
try:
conn = self._tls.connection
except AttributeError:
util.debug('thread %r does not own a connection',
threading.current_thread().name)
self._connect()
conn = self._tls.connection
> conn.send((self._id, methodname, args, kwds))
/usr/lib/python3.7/multiprocessing/managers.py:795:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <multiprocessing.connection.Connection object at 0x7f5930270198>
obj = ('7f58f846bd88', 'append', (('snapshot', Snapshot(branches={b'\x0000000': SnapshotBranch(target=b'\x00\x00\x00\x00\x00...\x00', target_type=<TargetType.CONTENT: 'content'>)}, id=b'/2\xc2\x8fe\xe1s#\xfcp\x1c.\xda\xe8$X\xd8\x13[\xa8')),), {})
def send(self, obj):
"""Send a (picklable) object"""
self._check_closed()
self._check_writable()
> self._send_bytes(_ForkingPickler.dumps(obj))
/usr/lib/python3.7/multiprocessing/connection.py:206:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <multiprocessing.connection.Connection object at 0x7f5930270198>
buf = <memory at 0x7f5848c0adc8>
def _send_bytes(self, buf):
n = len(buf)
# For wire compatibility with 3.2 and lower
header = struct.pack("!i", n)
if n > 16384:
# The payload is large so Nagle's algorithm won't be triggered
# and we'd better avoid the cost of concatenation.
> self._send(header)
/usr/lib/python3.7/multiprocessing/connection.py:397:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <multiprocessing.connection.Connection object at 0x7f5930270198>
buf = b'\x00\x05\xf1\xe1', write = <built-in function write>
def _send(self, buf, write=_write):
remaining = len(buf)
while True:
> n = write(self._handle, buf)
E BrokenPipeError: [Errno 32] Broken pipe
/usr/lib/python3.7/multiprocessing/connection.py:368: BrokenPipeError
During handling of the above exception, another exception occurred:
swh_storage = <swh.storage.validate.ValidatingProxyStorage object at 0x7f5852b58400>
@given(branch_name=branch_names(), branch_target=branch_targets(only_objects=True))
> def test_snapshot_large(swh_storage, branch_name, branch_target): # noqa
.tox/py3/lib/python3.7/site-packages/swh/storage/tests/algos/test_snapshot.py:25:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/py3/lib/python3.7/site-packages/hypothesis/core.py:708: in _execute_once_for_engine
data.mark_interesting((type(e), filename, lineno))
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:1060: in mark_interesting
self.conclude_test(Status.INTERESTING, interesting_origin)
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:1056: in conclude_test
self.freeze()
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/data.py:984: in freeze
self.observer.conclude_test(self.status, self.interesting_origin)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <hypothesis.internal.conjecture.datatree.TreeRecordingObserver object at 0x7f58408fe828>
status = Status.INTERESTING
interesting_origin = (<class 'BrokenPipeError'>, '/usr/lib/python3.7/multiprocessing/connection.py', 368)
def conclude_test(self, status, interesting_origin):
"""Says that ``status`` occurred at node ``node``. This updates the
node if necessary and checks for consistency."""
if status == Status.OVERRUN:
return
i = self.__index_in_current_node
node = self.__current_node
if i < len(node.values) or isinstance(node.transition, Branch):
inconsistent_generation()
new_transition = conclusion(status, interesting_origin)
if node.transition is not None and node.transition != new_transition:
# As an, I'm afraid, horrible bodge, we deliberately ignore flakiness
# where tests go from interesting to valid, because it's much easier
# to produce good error messages for these further up the stack.
if isinstance(node.transition, Conclusion) and (
node.transition.status != Status.INTERESTING
or new_transition.status != Status.VALID
):
raise Flaky(
"Inconsistent test results! Test case was %r on first run but %r on second"
> % (node.transition, new_transition)
)
E hypothesis.errors.Flaky: Inconsistent test results! Test case was Conclusion(status=Status.INTERESTING, interesting_origin=(<class 'EOFError'>, '/usr/lib/python3.7/multiprocessing/connection.py', 383)) on first run but Conclusion(status=Status.INTERESTING, interesting_origin=(<class 'BrokenPipeError'>, '/usr/lib/python3.7/multiprocessing/connection.py', 368)) on second
.tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/datatree.py:422: Flaky
TEST RESULT
TEST RESULT
- Run At
- Jun 3 2020, 12:44 PM