Page MenuHomeSoftware Heritage

Jenkins > .tox.py3.lib.python3.7.site-packages.swh.loader.tests.test_cli::test_run_with_visit_date
Failed

TEST RESULT

Run At
Apr 27 2022, 4:12 PM
Details
__wrapped_mock_method__ = <function NonCallableMock.assert_called_with at 0x7f5576e34c80> args = (<MagicMock name='get_loader' id='140004951926320'>, 'npm') kwargs = {'storage': {'cls': 'memory'}, 'url': 'https://some-url', 'visit_date': datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone.utc)} __tracebackhide__ = True msg = "Expected call: get_loader('npm', storage={'cls': 'memory'}, url='https://some-url', visit_date=datetime.datetime(2016...als': None,\n 'storage': {'cls': 'memory'},...\n \n ...Full output truncated (7 lines hidden), use '-vv' to show" __mock_self = <MagicMock name='get_loader' id='140004951926320'> actual_args = ('npm',) actual_kwargs = {'metadata_fetcher_credentials': None, 'storage': {'cls': 'memory'}, 'url': 'https://some-url', 'visit_date': datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone(datetime.timedelta(0), '+00:00'))} introspection = "\nKwargs:\nassert {'metadata_fe...), '+00:00'))} == {'storage': {...timezone.utc)}\n Omitting 3 identical items, use...als': None,\n 'storage': {'cls': 'memory'},...\n \n ...Full output truncated (7 lines hidden), use '-vv' to show" @py_assert2 = None, @py_assert1 = False def assert_wrapper( __wrapped_mock_method__: Callable[..., Any], *args: Any, **kwargs: Any ) -> None: __tracebackhide__ = True try: > __wrapped_mock_method__(*args, **kwargs) .tox/py3/lib/python3.7/site-packages/pytest_mock/plugin.py:414: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _mock_self = <MagicMock name='get_loader' id='140004951926320'>, args = ('npm',) kwargs = {'storage': {'cls': 'memory'}, 'url': 'https://some-url', 'visit_date': datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone.utc)} expected = (('npm',), {'storage': {'cls': 'memory'}, 'url': 'https://some-url', 'visit_date': datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone.utc)}) _error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f55717e9f28> actual = call('npm', metadata_fetcher_credentials=None, storage={'cls': 'memory'}, url='https://some-url', visit_date=datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone(datetime.timedelta(0), '+00:00'))) cause = None def assert_called_with(_mock_self, *args, **kwargs): """assert that the mock was called with the specified arguments. Raises an AssertionError if the args and keyword args passed in are different to the last call to the mock.""" self = _mock_self if self.call_args is None: expected = self._format_mock_call_signature(args, kwargs) raise AssertionError('Expected call: %s\nNot called' % (expected,)) def _error_message(): msg = self._format_mock_failure_message(args, kwargs) return msg expected = self._call_matcher((args, kwargs)) actual = self._call_matcher(self.call_args) if expected != actual: cause = expected if isinstance(expected, Exception) else None > raise AssertionError(_error_message()) from cause E AssertionError: Expected call: get_loader('npm', storage={'cls': 'memory'}, url='https://some-url', visit_date=datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone.utc)) E Actual call: get_loader('npm', metadata_fetcher_credentials=None, storage={'cls': 'memory'}, url='https://some-url', visit_date=datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone(datetime.timedelta(0), '+00:00'))) /usr/lib/python3.7/unittest/mock.py:829: AssertionError During handling of the above exception, another exception occurred: __wrapped_mock_method__ = <function NonCallableMock.assert_called_once_with at 0x7f5576e34d08> args = (<MagicMock name='get_loader' id='140004951926320'>, 'npm') kwargs = {'storage': {'cls': 'memory'}, 'url': 'https://some-url', 'visit_date': datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone.utc)} __tracebackhide__ = True msg = "Expected call: get_loader('npm', storage={'cls': 'memory'}, url='https://some-url', visit_date=datetime.datetime(2016...als': None,\n 'storage': {'cls': 'memory'},...\n \n ...Full output truncated (7 lines hidden), use '-vv' to show" def assert_wrapper( __wrapped_mock_method__: Callable[..., Any], *args: Any, **kwargs: Any ) -> None: __tracebackhide__ = True try: > __wrapped_mock_method__(*args, **kwargs) .tox/py3/lib/python3.7/site-packages/pytest_mock/plugin.py:414: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _mock_self = <MagicMock name='get_loader' id='140004951926320'>, args = ('npm',) kwargs = {'storage': {'cls': 'memory'}, 'url': 'https://some-url', 'visit_date': datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone.utc)} self = <MagicMock name='get_loader' id='140004951926320'> def assert_called_once_with(_mock_self, *args, **kwargs): """assert that the mock was called exactly once and that that call was with the specified arguments.""" self = _mock_self if not self.call_count == 1: msg = ("Expected '%s' to be called once. Called %s times." % (self._mock_name or 'mock', self.call_count)) raise AssertionError(msg) > return self.assert_called_with(*args, **kwargs) /usr/lib/python3.7/unittest/mock.py:840: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ args = (<MagicMock name='get_loader' id='140004951926320'>, 'npm') kwargs = {'storage': {'cls': 'memory'}, 'url': 'https://some-url', 'visit_date': datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone.utc)} __tracebackhide__ = True def wrap_assert_called_with(*args: Any, **kwargs: Any) -> None: __tracebackhide__ = True > assert_wrapper(_mock_module_originals["assert_called_with"], *args, **kwargs) .tox/py3/lib/python3.7/site-packages/pytest_mock/plugin.py:447: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __wrapped_mock_method__ = <function NonCallableMock.assert_called_with at 0x7f5576e34c80> args = (<MagicMock name='get_loader' id='140004951926320'>, 'npm') kwargs = {'storage': {'cls': 'memory'}, 'url': 'https://some-url', 'visit_date': datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone.utc)} __tracebackhide__ = True msg = "Expected call: get_loader('npm', storage={'cls': 'memory'}, url='https://some-url', visit_date=datetime.datetime(2016...als': None,\n 'storage': {'cls': 'memory'},...\n \n ...Full output truncated (7 lines hidden), use '-vv' to show" __mock_self = <MagicMock name='get_loader' id='140004951926320'> actual_args = ('npm',) actual_kwargs = {'metadata_fetcher_credentials': None, 'storage': {'cls': 'memory'}, 'url': 'https://some-url', 'visit_date': datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone(datetime.timedelta(0), '+00:00'))} introspection = "\nKwargs:\nassert {'metadata_fe...), '+00:00'))} == {'storage': {...timezone.utc)}\n Omitting 3 identical items, use...als': None,\n 'storage': {'cls': 'memory'},...\n \n ...Full output truncated (7 lines hidden), use '-vv' to show" @py_assert2 = None, @py_assert1 = False def assert_wrapper( __wrapped_mock_method__: Callable[..., Any], *args: Any, **kwargs: Any ) -> None: __tracebackhide__ = True try: __wrapped_mock_method__(*args, **kwargs) return except AssertionError as e: if getattr(e, "_mock_introspection_applied", 0): msg = str(e) else: __mock_self = args[0] msg = str(e) if __mock_self.call_args is not None: actual_args, actual_kwargs = __mock_self.call_args introspection = "" try: assert actual_args == args[1:] except AssertionError as e_args: introspection += "\nArgs:\n" + str(e_args) try: assert actual_kwargs == kwargs except AssertionError as e_kwargs: introspection += "\nKwargs:\n" + str(e_kwargs) if introspection: msg += "\n\npytest introspection follows:\n" + introspection e = AssertionError(msg) e._mock_introspection_applied = True # type:ignore[attr-defined] > raise e E AssertionError: Expected call: get_loader('npm', storage={'cls': 'memory'}, url='https://some-url', visit_date=datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone.utc)) E Actual call: get_loader('npm', metadata_fetcher_credentials=None, storage={'cls': 'memory'}, url='https://some-url', visit_date=datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone(datetime.timedelta(0), '+00:00'))) E E pytest introspection follows: E E Kwargs: E assert {'metadata_fe...), '+00:00'))} == {'storage': {...timezone.utc)} E Omitting 3 identical items, use -vv to show E Left contains 1 more item: E {'metadata_fetcher_credentials': None} E Full diff: E { E + 'metadata_fetcher_credentials': None, E 'storage': {'cls': 'memory'},... E E ...Full output truncated (7 lines hidden), use '-vv' to show .tox/py3/lib/python3.7/site-packages/pytest_mock/plugin.py:437: AssertionError During handling of the above exception, another exception occurred: mocker = <pytest_mock.plugin.MockerFixture object at 0x7f55716420b8> swh_config = '/tmp/pytest-of-jenkins/pytest-0/test_run_with_visit_date0/loader.yml' def test_run_with_visit_date(mocker, swh_config): """iso visit_date parameter should be parsed as datetime""" mock_loader = mocker.patch("swh.loader.cli.get_loader") runner = CliRunner() input_date = "2016-05-03 15:16:32+00" result = runner.invoke( loader_cli, ["run", "npm", "https://some-url", f"visit_date='{input_date}'"] ) assert result.exit_code == 0 expected_parsed_date = datetime.datetime( 2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone.utc ) mock_loader.assert_called_once_with( "npm", storage={"cls": "memory"}, url="https://some-url", > visit_date=expected_parsed_date, ) E AssertionError: Expected call: get_loader('npm', storage={'cls': 'memory'}, url='https://some-url', visit_date=datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone.utc)) E Actual call: get_loader('npm', metadata_fetcher_credentials=None, storage={'cls': 'memory'}, url='https://some-url', visit_date=datetime.datetime(2016, 5, 3, 15, 16, 32, tzinfo=datetime.timezone(datetime.timedelta(0), '+00:00'))) E E pytest introspection follows: E E Kwargs: E assert {'metadata_fe...), '+00:00'))} == {'storage': {...timezone.utc)} E Omitting 3 identical items, use -vv to show E Left contains 1 more item: E {'metadata_fetcher_credentials': None} E Full diff: E { E + 'metadata_fetcher_credentials': None, E 'storage': {'cls': 'memory'},... E E ...Full output truncated (7 lines hidden), use '-vv' to show .tox/py3/lib/python3.7/site-packages/swh/loader/tests/test_cli.py:126: AssertionError