Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.api.views.test_origin::test_api_lookup_origin_visits_by_id
Failed

TEST RESULT

Run At
Jun 2 2022, 3:55 PM
Details
self = <hypothesis.core.StateForActualGivenExecution object at 0x7f157ba2bba8> data = ConjectureData(INTERESTING, 498 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: trace = frozenset() if ( self.failed_normally and not self.failed_due_to_deadline and Phase.shrink in self.settings.phases and Phase.explain in self.settings.phases and sys.gettrace() is None and not PYPY ): # pragma: no cover # This is in fact covered by our *non-coverage* tests, but due to the # settrace() contention *not* by our coverage tests. Ah well. tracer = Tracer() try: sys.settrace(tracer.trace) result = self.execute_once(data) if data.status == Status.VALID: self.explain_traces[None].add(frozenset(tracer.branches)) finally: sys.settrace(None) trace = frozenset(tracer.branches) else: > result = self.execute_once(data) .tox/py3/lib/python3.7/site-packages/hypothesis/core.py:724: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <hypothesis.core.StateForActualGivenExecution object at 0x7f157ba2bba8> data = ConjectureData(INTERESTING, 498 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 = 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: nonlocal text_repr text_repr = repr_call(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() for i, (k, v) in enumerate(kwargs.items()): 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:662: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ data = ConjectureData(INTERESTING, 498 bytes, frozen) function = <function StateForActualGivenExecution.execute_once.<locals>.run at 0x7f157c8bb268> def default_new_style_executor(data, function): > return function(data) .tox/py3/lib/python3.7/site-packages/hypothesis/executors.py:47: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ data = ConjectureData(INTERESTING, 498 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: nonlocal text_repr text_repr = repr_call(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() for i, (k, v) in enumerate(kwargs.items()): 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:658: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ api_client = <rest_framework.test.APIClient object at 0x7f157ba2b518> subtest = <function subtest.<locals>.inner at 0x7f157e4eab70> new_origin = Origin(url='git://zff4bajajt2.j.vnd️vr.bw', id=b'\xf9v,]FD\xc8\xa4\\V\xaa\xf4\x10\xa5`\x17\x8d\xfbd#') visit_dates = [datetime.datetime(2019, 6, 25, 17, 17, 52, 437211, tzinfo=tzfile('/usr/share/zoneinfo/America/Whitehorse')), datetime...fo/America/Noronha')), datetime.datetime(2022, 6, 2, 7, 27, 23, 579471, tzinfo=tzfile('/usr/share/zoneinfo/US/Samoa'))] new_snapshots = [Snapshot(branches=ImmutableDict({b'\x9f\xcf\xa0\x0c\xf2\xa5': None, b'\x85(\xf5t\xb4': None, b'\xfd\xc6\x91\xd9q9\x92...ae271fd17e535cad5'), target_type=TargetType.REVISION)}), id=hash_to_bytes('8e81faeb03d60f4ac52b31b1d93baa54d28db6f4'))] @given(new_origin(), visit_dates(3), new_snapshots(3)) def test_api_lookup_origin_visits_by_id( api_client, subtest, new_origin, visit_dates, new_snapshots ): # ensure archive_data fixture will be reset between each hypothesis # example test run > @subtest def test_inner(archive_data): .tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_origin.py:134: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ func = <function test_api_lookup_origin_visits_by_id.<locals>.test_inner at 0x7f157c967ae8> def inner(func): if hasattr(Function, "from_parent"): item = Function.from_parent( parent_test, name=request.function.__name__ + "[]", originalname=request.function.__name__, callobj=func, ) else: item = Function( name=request.function.__name__ + "[]", parent=parent_test, callobj=func ) nextitem = parent_test # prevents pytest from tearing down module fixtures > item.ihook.pytest_runtest_setup(item=item) .tox/py3/lib/python3.7/site-packages/swh/web/tests/conftest.py:1105: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_HookCaller 'pytest_runtest_setup'>, args = () kwargs = {'item': <Function test_api_lookup_origin_visits_by_id[]>} argname = 'item', firstresult = False def __call__(self, *args, **kwargs): if args: raise TypeError("hook calling supports only keyword arguments") assert not self.is_historic() # This is written to avoid expensive operations when not needed. if self.spec: for argname in self.spec.argnames: if argname not in kwargs: notincall = tuple(set(self.spec.argnames) - kwargs.keys()) warnings.warn( "Argument(s) {} which are declared in the hookspec " "can not be found in this hook call".format(notincall), stacklevel=2, ) break firstresult = self.spec.opts.get("firstresult") else: firstresult = False > return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult) .tox/py3/lib/python3.7/site-packages/pluggy/_hooks.py:265: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.config.PytestPluginManager object at 0x7f1592612ef0> hook_name = 'pytest_runtest_setup' methods = [<HookImpl plugin_name='nose', plugin=<module '_pytest.nose' from '/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.to...xture=None>>, <HookImpl plugin_name='logging-plugin', plugin=<_pytest.logging.LoggingPlugin object at 0x7f158a904588>>] kwargs = {'item': <Function test_api_lookup_origin_visits_by_id[]>} firstresult = False def _hookexec(self, hook_name, methods, kwargs, firstresult): # called from all hookcaller instances. # enable_tracing will set its own wrapping function at self._inner_hookexec > return self._inner_hookexec(hook_name, methods, kwargs, firstresult) .tox/py3/lib/python3.7/site-packages/pluggy/_manager.py:80: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_setup' hook_impls = [<HookImpl plugin_name='nose', plugin=<module '_pytest.nose' from '/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.to...xture=None>>, <HookImpl plugin_name='logging-plugin', plugin=<_pytest.logging.LoggingPlugin object at 0x7f158a904588>>] caller_kwargs = {'item': <Function test_api_lookup_origin_visits_by_id[]>} firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: res = hook_impl.function(*args) if res is not None: results.append(res) if firstresult: # halt further impl calls break except BaseException: excinfo = sys.exc_info() finally: if firstresult: # first result hooks return a single value outcome = _Result(results[0] if results else None, excinfo) else: outcome = _Result(results, excinfo) # run all wrapper post-yield blocks for gen in reversed(teardowns): try: gen.send(outcome) _raise_wrapfail(gen, "has second yield") except StopIteration: pass > return outcome.get_result() .tox/py3/lib/python3.7/site-packages/pluggy/_callers.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <pluggy._result._Result object at 0x7f157c26e2e8> def get_result(self): """Get the result(s) for this hook call. If the hook was marked as a ``firstresult`` only a single value will be returned otherwise a list of results. """ __tracebackhide__ = True if self._excinfo is None: return self._result else: ex = self._excinfo > raise ex[1].with_traceback(ex[2]) .tox/py3/lib/python3.7/site-packages/pluggy/_result.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ hook_name = 'pytest_runtest_setup' hook_impls = [<HookImpl plugin_name='nose', plugin=<module '_pytest.nose' from '/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.to...xture=None>>, <HookImpl plugin_name='logging-plugin', plugin=<_pytest.logging.LoggingPlugin object at 0x7f158a904588>>] caller_kwargs = {'item': <Function test_api_lookup_origin_visits_by_id[]>} firstresult = False def _multicall(hook_name, hook_impls, caller_kwargs, firstresult): """Execute a call into multiple python functions/methods and return the result(s). ``caller_kwargs`` comes from _HookCaller.__call__(). """ __tracebackhide__ = True results = [] excinfo = None try: # run impl and wrapper setup functions in a loop teardowns = [] try: for hook_impl in reversed(hook_impls): try: args = [caller_kwargs[argname] for argname in hook_impl.argnames] except KeyError: for argname in hook_impl.argnames: if argname not in caller_kwargs: raise HookCallError( f"hook call must provide argument {argname!r}" ) if hook_impl.hookwrapper: try: gen = hook_impl.function(*args) next(gen) # first yield teardowns.append(gen) except StopIteration: _raise_wrapfail(gen, "did not yield") else: > res = hook_impl.function(*args) .tox/py3/lib/python3.7/site-packages/pluggy/_callers.py:39: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ item = <Function test_api_lookup_origin_visits_by_id[]> def pytest_runtest_setup(item: Item) -> None: _update_current_test_var(item, "setup") > item.session._setupstate.setup(item) .tox/py3/lib/python3.7/site-packages/_pytest/runner.py:154: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <_pytest.runner.SetupState object at 0x7f158a9bafd0> item = <Function test_api_lookup_origin_visits_by_id[]> def setup(self, item: Item) -> None: """Setup objects along the collector chain to the item.""" needed_collectors = item.listchain() # If a collector fails its setup, fail its entire subtree of items. # The setup is not retried for each item - the same exception is used. for col, (finalizers, exc) in self.stack.items(): > assert col in needed_collectors, "previous item was not torn down properly" E AssertionError: previous item was not torn down properly .tox/py3/lib/python3.7/site-packages/_pytest/runner.py:482: AssertionError During handling of the above exception, another exception occurred: api_client = <rest_framework.test.APIClient object at 0x7f157ba2b518> subtest = <function subtest.<locals>.inner at 0x7f157e4eab70> @given(new_origin(), visit_dates(3), new_snapshots(3)) > def test_api_lookup_origin_visits_by_id( api_client, subtest, new_origin, visit_dates, new_snapshots ): .tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_origin.py:129: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = <hypothesis.internal.conjecture.datatree.TreeRecordingObserver object at 0x7f157d878e48> status = Status.INTERESTING interesting_origin = (<class 'AssertionError'>, '/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/_pytest/runner.py', 482, (), ()) 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( > f"Inconsistent test results! Test case was {node.transition!r} " f"on first run but {new_transition!r} on second" ) E hypothesis.errors.Flaky: Inconsistent test results! Test case was Conclusion(status=Status.INTERESTING, interesting_origin=(<class 'AssertionError'>, '/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/swh/web/tests/api/views/test_origin.py', 180, (), ())) on first run but Conclusion(status=Status.INTERESTING, interesting_origin=(<class 'AssertionError'>, '/var/lib/jenkins/workspace/DWAPPS/tests-on-diff/.tox/py3/lib/python3.7/site-packages/_pytest/runner.py', 482, (), ())) on second .tox/py3/lib/python3.7/site-packages/hypothesis/internal/conjecture/datatree.py:407: Flaky