Page MenuHomeSoftware Heritage

Jenkins > .tox.py3-core-db-server-slow-cover.lib.python3.7.site-packages.swh.core.tests.test_cli::test_sentry_env
Failed

TEST RESULT

Run At
Apr 13 2022, 2:52 PM
Details
__wrapped_mock_method__ = <function NonCallableMock.assert_called_with at 0x7f8bacf6f048> args = (<MagicMock name='init' id='140237823523080'>,) kwargs = {'debug': True, 'dsn': 'test_dsn', 'environment': None, 'integrations': [], ...} __tracebackhide__ = True msg = "Expected call: init(debug=True, dsn='test_dsn', environment=None, integrations=[], release=None)\nActual call: init(b...>, ignored_exceptions=()),\n 'debug': True,...\n \n ...Full output truncated (6 lines hidden), use '-vv' to show" __mock_self = <MagicMock name='init' id='140237823523080'>, actual_args = () actual_kwargs = {'before_send': functools.partial(<function before_send at 0x7f8ba9d3cc80>, ignored_exceptions=()), 'debug': True, 'dsn': 'test_dsn', 'environment': None, ...} introspection = "\nKwargs:\nassert {'before_send...t': None, ...} == {'debug': Tru...ons': [], ...}\n Omitting 5 identical items, use...>, ignored_exceptions=()),\n 'debug': True,...\n \n ...Full output truncated (6 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-core-db-server-slow-cover/lib/python3.7/site-packages/pytest_mock/plugin.py:414: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _mock_self = <MagicMock name='init' id='140237823523080'>, args = () kwargs = {'debug': True, 'dsn': 'test_dsn', 'environment': None, 'integrations': [], ...} expected = ((), {'debug': True, 'dsn': 'test_dsn', 'environment': None, 'integrations': [], ...}) _error_message = <function NonCallableMock.assert_called_with.<locals>._error_message at 0x7f8ba9b9cc80> actual = call(before_send=functools.partial(<function before_send at 0x7f8ba9d3cc80>, ignored_exceptions=()), debug=True, dsn='test_dsn', environment=None, integrations=[], release=None) 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: init(debug=True, dsn='test_dsn', environment=None, integrations=[], release=None) E Actual call: init(before_send=functools.partial(<function before_send at 0x7f8ba9d3cc80>, ignored_exceptions=()), debug=True, dsn='test_dsn', environment=None, integrations=[], release=None) /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 0x7f8bacf6f0d0> args = (<MagicMock name='init' id='140237823523080'>,) kwargs = {'debug': True, 'dsn': 'test_dsn', 'environment': None, 'integrations': [], ...} __tracebackhide__ = True msg = "Expected call: init(debug=True, dsn='test_dsn', environment=None, integrations=[], release=None)\nActual call: init(b...>, ignored_exceptions=()),\n 'debug': True,...\n \n ...Full output truncated (6 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-core-db-server-slow-cover/lib/python3.7/site-packages/pytest_mock/plugin.py:414: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _mock_self = <MagicMock name='init' id='140237823523080'>, args = () kwargs = {'debug': True, 'dsn': 'test_dsn', 'environment': None, 'integrations': [], ...} self = <MagicMock name='init' id='140237823523080'> 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='init' id='140237823523080'>,) kwargs = {'debug': True, 'dsn': 'test_dsn', 'environment': None, 'integrations': [], ...} __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-core-db-server-slow-cover/lib/python3.7/site-packages/pytest_mock/plugin.py:447: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __wrapped_mock_method__ = <function NonCallableMock.assert_called_with at 0x7f8bacf6f048> args = (<MagicMock name='init' id='140237823523080'>,) kwargs = {'debug': True, 'dsn': 'test_dsn', 'environment': None, 'integrations': [], ...} __tracebackhide__ = True msg = "Expected call: init(debug=True, dsn='test_dsn', environment=None, integrations=[], release=None)\nActual call: init(b...>, ignored_exceptions=()),\n 'debug': True,...\n \n ...Full output truncated (6 lines hidden), use '-vv' to show" __mock_self = <MagicMock name='init' id='140237823523080'>, actual_args = () actual_kwargs = {'before_send': functools.partial(<function before_send at 0x7f8ba9d3cc80>, ignored_exceptions=()), 'debug': True, 'dsn': 'test_dsn', 'environment': None, ...} introspection = "\nKwargs:\nassert {'before_send...t': None, ...} == {'debug': Tru...ons': [], ...}\n Omitting 5 identical items, use...>, ignored_exceptions=()),\n 'debug': True,...\n \n ...Full output truncated (6 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: init(debug=True, dsn='test_dsn', environment=None, integrations=[], release=None) E Actual call: init(before_send=functools.partial(<function before_send at 0x7f8ba9d3cc80>, ignored_exceptions=()), debug=True, dsn='test_dsn', environment=None, integrations=[], release=None) E E pytest introspection follows: E E Kwargs: E assert {'before_send...t': None, ...} == {'debug': Tru...ons': [], ...} E Omitting 5 identical items, use -vv to show E Left contains 1 more item: E {'before_send': functools.partial(<function before_send at 0x7f8ba9d3cc80>, ignored_exceptions=())} E Full diff: E { E + 'before_send': functools.partial(<function before_send at 0x7f8ba9d3cc80>, ignored_exceptions=()), E 'debug': True,... E E ...Full output truncated (6 lines hidden), use '-vv' to show .tox/py3-core-db-server-slow-cover/lib/python3.7/site-packages/pytest_mock/plugin.py:437: AssertionError During handling of the above exception, another exception occurred: swhmain = <AliasedGroup swh> def test_sentry_env(swhmain): @swhmain.command(name="test") @click.pass_context def swhtest(ctx): click.echo("Hello SWH!") runner = CliRunner() with patch("sentry_sdk.init") as sentry_sdk_init: env = { "SWH_SENTRY_DSN": "test_dsn", "SWH_SENTRY_DEBUG": "1", } result = runner.invoke(swhmain, ["test"], env=env, auto_envvar_prefix="SWH") assert result.exit_code == 0 assert result.output.strip() == """Hello SWH!""" sentry_sdk_init.assert_called_once_with( dsn="test_dsn", debug=True, integrations=[], release=None, > environment=None, ) E AssertionError: Expected call: init(debug=True, dsn='test_dsn', environment=None, integrations=[], release=None) E Actual call: init(before_send=functools.partial(<function before_send at 0x7f8ba9d3cc80>, ignored_exceptions=()), debug=True, dsn='test_dsn', environment=None, integrations=[], release=None) E E pytest introspection follows: E E Kwargs: E assert {'before_send...t': None, ...} == {'debug': Tru...ons': [], ...} E Omitting 5 identical items, use -vv to show E Left contains 1 more item: E {'before_send': functools.partial(<function before_send at 0x7f8ba9d3cc80>, ignored_exceptions=())} E Full diff: E { E + 'before_send': functools.partial(<function before_send at 0x7f8ba9d3cc80>, ignored_exceptions=()), E 'debug': True,... E E ...Full output truncated (6 lines hidden), use '-vv' to show .tox/py3-core-db-server-slow-cover/lib/python3.7/site-packages/swh/core/tests/test_cli.py:203: AssertionError