{"action":"opened","issue":{"url":"https://api.github.com/repos/jtushman/state_machine/issues/25","labels_url":"https://api.github.com/repos/jtushman/state_machine/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/jtushman/state_machine/issues/25/comments","events_url":"https://api.github.com/repos/jtushman/state_machine/issues/25/events","html_url":"https://github.com/jtushman/state_machine/issues/25","id":130037182,"number":25,"title":"Tests failing (mongoengine) - use of a metaclass","user":{"login":"bagerard","id":11854690,"avatar_url":"https://avatars.githubusercontent.com/u/11854690?v=3","gravatar_id":"","url":"https://api.github.com/users/bagerard","html_url":"https://github.com/bagerard","followers_url":"https://api.github.com/users/bagerard/followers","following_url":"https://api.github.com/users/bagerard/following{/other_user}","gists_url":"https://api.github.com/users/bagerard/gists{/gist_id}","starred_url":"https://api.github.com/users/bagerard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bagerard/subscriptions","organizations_url":"https://api.github.com/users/bagerard/orgs","repos_url":"https://api.github.com/users/bagerard/repos","events_url":"https://api.github.com/users/bagerard/events{/privacy}","received_events_url":"https://api.github.com/users/bagerard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-30T21:12:50Z","updated_at":"2016-01-30T21:12:50Z","closed_at":null,"body":"Few tests are failing when ran against the latest mongoengine (0.10.5). After some debugging, it looks like it breaks some mongoengine internals when it uses type(...) to instantiate the modified class.\r\n```\r\nclazz = type(class_name, original_class.__bases__, class_dict)\r\n```\r\nThis makes the Document.id field not in line with the object's pk after a .save(). I tried to fix it but ended up re-writing the state machine using a metaclass and it now works wonderfully. Let me know in case you are interested in a PR."}}