{"action":"created","issue":{"url":"https://api.github.com/repos/testing-cabal/mock/issues/219","repository_url":"https://api.github.com/repos/testing-cabal/mock","labels_url":"https://api.github.com/repos/testing-cabal/mock/issues/219/labels{/name}","comments_url":"https://api.github.com/repos/testing-cabal/mock/issues/219/comments","events_url":"https://api.github.com/repos/testing-cabal/mock/issues/219/events","html_url":"https://github.com/testing-cabal/mock/issues/219","id":69949879,"node_id":"MDU6SXNzdWU2OTk0OTg3OQ==","number":219,"title":"PropertyMock refuses to raise AttributeErrror as a side effect","user":{"login":"GoogleCodeExporter","id":9614759,"node_id":"MDQ6VXNlcjk2MTQ3NTk=","avatar_url":"https://avatars0.githubusercontent.com/u/9614759?v=4","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"id":202498143,"node_id":"MDU6TGFiZWwyMDI0OTgxNDM=","url":"https://api.github.com/repos/testing-cabal/mock/labels/Priority-Medium","name":"Priority-Medium","color":"ededed","default":false},{"id":202498195,"node_id":"MDU6TGFiZWwyMDI0OTgxOTU=","url":"https://api.github.com/repos/testing-cabal/mock/labels/Type-Defect","name":"Type-Defect","color":"ededed","default":false},{"id":202498145,"node_id":"MDU6TGFiZWwyMDI0OTgxNDU=","url":"https://api.github.com/repos/testing-cabal/mock/labels/auto-migrated","name":"auto-migrated","color":"ededed","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2015-04-21T20:54:33Z","updated_at":"2018-11-29T08:17:48Z","closed_at":"2018-11-29T08:17:48Z","author_association":"NONE","body":"```\nWhat steps will reproduce the problem?\n\n>>> import mock\n>>> a_mock = mock.MagicMock()\n>>> no_attribute = mock.PropertyMock(side_effect=AttributeError)\n>>> type(a_mock).property = no_attribute\n\n\n\nWhat is the expected output? What do you see instead?\n\nI would expect the above to raise an AttributeError. Instead it returns a \nMagicMock instance.\n\n>>> a_mock.property\n<MagicMock name='mock.property' id='140165240345424'>\n\nI would expect it to have the same effect as calling a PropertyMock with any \nother exception as a side effect:\n\n>>> mock_value_error = mock.PropertyMock(side_effect=ValueError)\n>>> type(a_mock).other_property = mock_value_error\n>>> a_mock.other_property\nTraceback (most recent call last):\n  File \"<stdin>\", line 1, in <module>\n  File \"/home/ahammel/bin/python/mock-1.0.1-py2.6.egg/mock.py\", line 2365, in __get__\n    return self()\n  File \"/home/ahammel/bin/python/mock-1.0.1-py2.6.egg/mock.py\", line 955, in __call__\n    return _mock_self._mock_call(*args, **kwargs)\n  File \"/home/ahammel/bin/python/mock-1.0.1-py2.6.egg/mock.py\", line 1010, in _mock_call\n    raise effect\nValueError\n\n\n\nWhat version of the product are you using? On what operating system?\n\nUsing version mock-1.0.1-py2.6 on CentOS 6.4\n\n\n\nPlease provide any additional information below.\n\nPropertyMock objects apparently won't raise sublcasses of AttributeError either:\n\n>>> class MockAttributeError(AttributeError): pass\n... \n>>> no_attr = mock.PropertyMock(side_effect=MockAttributeError)\n>>> type(a_mock).property = no_attr\n>>> a_mock.property\n<MagicMock name='mock.property' id='140165240345424'>\n\nWorks fine for subclasses of other Exceptions:\n\n>>> class MockKeyError(KeyError): pass\n... \n>>> no_key = mock.PropertyMock(side_effect=MockKeyError)\n>>> type(a_mock).property = no_key\n>>> a_mock.property\nTraceback (most recent call last):\n  File \"<stdin>\", line 1, in <module>\n  File \"/home/ahammel/bin/python/mock-1.0.1-py2.6.egg/mock.py\", line 2365, in __get__\n    return self()\n  File \"/home/ahammel/bin/python/mock-1.0.1-py2.6.egg/mock.py\", line 955, in __call__\n    return _mock_self._mock_call(*args, **kwargs)\n  File \"/home/ahammel/bin/python/mock-1.0.1-py2.6.egg/mock.py\", line 1010, in _mock_call\n    raise effect\n__main__.MockKeyError\n\n\nIt's apparently not just me:\n\nhttp://stackoverflow.com/questions/18236123/python-porpertymock-side-effect-with\n-attributeerror-and-valueerror\n```\n\nOriginal issue reported on code.google.com by `ahamme...@gmail.com` on 26 Nov 2013 at 6:20\n"},"comment":{"url":"https://api.github.com/repos/testing-cabal/mock/issues/comments/442744618","html_url":"https://github.com/testing-cabal/mock/issues/219#issuecomment-442744618","issue_url":"https://api.github.com/repos/testing-cabal/mock/issues/219","id":442744618,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0Mjc0NDYxOA==","user":{"login":"cjw296","id":632049,"node_id":"MDQ6VXNlcjYzMjA0OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/632049?v=4","gravatar_id":"","url":"https://api.github.com/users/cjw296","html_url":"https://github.com/cjw296","followers_url":"https://api.github.com/users/cjw296/followers","following_url":"https://api.github.com/users/cjw296/following{/other_user}","gists_url":"https://api.github.com/users/cjw296/gists{/gist_id}","starred_url":"https://api.github.com/users/cjw296/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjw296/subscriptions","organizations_url":"https://api.github.com/users/cjw296/orgs","repos_url":"https://api.github.com/users/cjw296/repos","events_url":"https://api.github.com/users/cjw296/events{/privacy}","received_events_url":"https://api.github.com/users/cjw296/received_events","type":"User","site_admin":false},"created_at":"2018-11-29T08:17:48Z","updated_at":"2018-11-29T08:17:48Z","author_association":"CONTRIBUTOR","body":"@heston - This repo is only for issues that are specific to the backport.\r\nPlease report issues with mock in the upstream bug tracker at https://bugs.python.org/.\r\nOnce issues are fixed upstream, they can be backported here.\r\n"}}
{"actor":{"display_login":"cjw296"}}