{"action":"opened","issue":{"url":"https://api.github.com/repos/kumoru/torment/issues/18","labels_url":"https://api.github.com/repos/kumoru/torment/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/kumoru/torment/issues/18/comments","events_url":"https://api.github.com/repos/kumoru/torment/issues/18/events","html_url":"https://github.com/kumoru/torment/issues/18","id":96186444,"number":18,"title":"magic mock properties must be in __new__","user":{"login":"alunduil","id":169249,"avatar_url":"https://avatars.githubusercontent.com/u/169249?v=3","gravatar_id":"","url":"https://api.github.com/users/alunduil","html_url":"https://github.com/alunduil","followers_url":"https://api.github.com/users/alunduil/followers","following_url":"https://api.github.com/users/alunduil/following{/other_user}","gists_url":"https://api.github.com/users/alunduil/gists{/gist_id}","starred_url":"https://api.github.com/users/alunduil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alunduil/subscriptions","organizations_url":"https://api.github.com/users/alunduil/orgs","repos_url":"https://api.github.com/users/alunduil/repos","events_url":"https://api.github.com/users/alunduil/events{/privacy}","received_events_url":"https://api.github.com/users/alunduil/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-20T23:21:08Z","updated_at":"2015-07-20T23:21:08Z","closed_at":null,"body":"The attempt at making magic mock properties isn't early enough in the class creation process.  I'm not sure how one would test this either but we can figure that out definitively later.\r\n\r\nWhen creating a base class that actually creates mocks, the ``mocks.add()`` call results in the following:\r\n\r\n```\r\nNameError: name 'mocks' is not defined\r\n```\r\n\r\nI believe we simply need to create those properties in MetaContext's __new__ method.  Testing might be as simple as trying to create a class with a ``mocks.add()`` call and checking for this error.\r\n\r\n* http://stackoverflow.com/questions/1840421/is-there-any-reason-to-choose-new-over-init-when-defining-a-metaclass\r\n"}}