{"action":"created","issue":{"url":"https://api.github.com/repos/django/django/issues/4192","labels_url":"https://api.github.com/repos/django/django/issues/4192/labels{/name}","comments_url":"https://api.github.com/repos/django/django/issues/4192/comments","events_url":"https://api.github.com/repos/django/django/issues/4192/events","html_url":"https://github.com/django/django/pull/4192","id":58532878,"number":4192,"title":"[WIP] Remove testing fixtures","user":{"login":"jarshwah","id":541083,"avatar_url":"https://avatars.githubusercontent.com/u/541083?v=3","gravatar_id":"","url":"https://api.github.com/users/jarshwah","html_url":"https://github.com/jarshwah","followers_url":"https://api.github.com/users/jarshwah/followers","following_url":"https://api.github.com/users/jarshwah/following{/other_user}","gists_url":"https://api.github.com/users/jarshwah/gists{/gist_id}","starred_url":"https://api.github.com/users/jarshwah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jarshwah/subscriptions","organizations_url":"https://api.github.com/users/jarshwah/orgs","repos_url":"https://api.github.com/users/jarshwah/repos","events_url":"https://api.github.com/users/jarshwah/events{/privacy}","received_events_url":"https://api.github.com/users/jarshwah/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-02-23T01:21:06Z","updated_at":"2015-08-09T02:25:31Z","closed_at":"2015-03-05T00:14:36Z","pull_request":{"url":"https://api.github.com/repos/django/django/pulls/4192","html_url":"https://github.com/django/django/pull/4192","diff_url":"https://github.com/django/django/pull/4192.diff","patch_url":"https://github.com/django/django/pull/4192.patch"},"body":"Test fixtures are really slow and harder to reason about than data created within the TestCase, so I've began the process of converting fixtures into the equivalent setUpTestData method.\r\n\r\nI'm partially automating the object generation by inserting print statements into `django.core.serializers.base`:\r\n\r\n```\r\n# def build_instance(Model, data, db):\r\n print('{}.objects.create({})'.format(str(Model.__name__), ', '.join(\"{}={}\".format(k, repr(v)) for k, v in six.iteritems(data))))\r\n\r\n# DeserializedObject(object).save:\r\nif self.m2m_data and save_m2m:\r\n            #print('obj = {}.objects.get(pk={})'.format(self.object.__class__.__name__, self.object.pk))\r\n            for accessor_name, object_list in self.m2m_data.items():\r\n                #print('obj.{}.add({})'.format(accessor_name, ', '.join(str(obj) for obj in object_list)))\r\n                setattr(self.object, accessor_name, object_list)\r\n```\r\n\r\nI then copy/paste, rearrange, and run the test suite again to verify everything is passing. So far so good.\r\n\r\nThere aren't a lot of test modules with fixtures anymore, so completing this shouldn't take an extraordinarily long time. We could probably live with the messiness of the auto-generated m2m syntax, but let me know if you'd prefer that cleaned up too.\r\n\r\nAre we happy with the conversion of fixtures within our own test suite? I'll specifically leave the fixtures test module alone so that we're still able to test fixture loading within tests."},"comment":{"url":"https://api.github.com/repos/django/django/issues/comments/129094939","html_url":"https://github.com/django/django/pull/4192#issuecomment-129094939","issue_url":"https://api.github.com/repos/django/django/issues/4192","id":129094939,"user":{"login":"caioariede","id":55533,"avatar_url":"https://avatars.githubusercontent.com/u/55533?v=3","gravatar_id":"","url":"https://api.github.com/users/caioariede","html_url":"https://github.com/caioariede","followers_url":"https://api.github.com/users/caioariede/followers","following_url":"https://api.github.com/users/caioariede/following{/other_user}","gists_url":"https://api.github.com/users/caioariede/gists{/gist_id}","starred_url":"https://api.github.com/users/caioariede/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caioariede/subscriptions","organizations_url":"https://api.github.com/users/caioariede/orgs","repos_url":"https://api.github.com/users/caioariede/repos","events_url":"https://api.github.com/users/caioariede/events{/privacy}","received_events_url":"https://api.github.com/users/caioariede/received_events","type":"User","site_admin":false},"created_at":"2015-08-09T02:25:31Z","updated_at":"2015-08-09T02:25:31Z","body":"I'm running it against master"}}