{"action":"created","issue":{"url":"https://api.github.com/repos/ellmetha/django-machina/issues/167","repository_url":"https://api.github.com/repos/ellmetha/django-machina","labels_url":"https://api.github.com/repos/ellmetha/django-machina/issues/167/labels{/name}","comments_url":"https://api.github.com/repos/ellmetha/django-machina/issues/167/comments","events_url":"https://api.github.com/repos/ellmetha/django-machina/issues/167/events","html_url":"https://github.com/ellmetha/django-machina/issues/167","id":491752868,"node_id":"MDU6SXNzdWU0OTE3NTI4Njg=","number":167,"title":"Tests failing on clean master branch","user":{"login":"BrendaH","id":5462600,"node_id":"MDQ6VXNlcjU0NjI2MDA=","avatar_url":"https://avatars2.githubusercontent.com/u/5462600?v=4","gravatar_id":"","url":"https://api.github.com/users/BrendaH","html_url":"https://github.com/BrendaH","followers_url":"https://api.github.com/users/BrendaH/followers","following_url":"https://api.github.com/users/BrendaH/following{/other_user}","gists_url":"https://api.github.com/users/BrendaH/gists{/gist_id}","starred_url":"https://api.github.com/users/BrendaH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrendaH/subscriptions","organizations_url":"https://api.github.com/users/BrendaH/orgs","repos_url":"https://api.github.com/users/BrendaH/repos","events_url":"https://api.github.com/users/BrendaH/events{/privacy}","received_events_url":"https://api.github.com/users/BrendaH/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-09-10T15:40:32Z","updated_at":"2019-09-24T08:01:01Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Django 2.2.4\r\nMachina 1.0.3\r\nOS: Windows 10\r\nPython: 3.5\r\n\r\nI'm working on a PR to fix issue #163 and wanted to write/update the tests to include my changes in the testing. However, I ran into some failing tests that have nothing to do with my code....\r\n\r\nI set up a test environment on my Windows machine by checking out (a fork of) the master branch, making a pipenv in the directory with the code, installing all missing dependencies (pathlib2, colorama) and then after starting a `pipenv shell` running `py.test`.\r\nI got a bunch of failing tests (3). When I reran py.test I got another failing test (1). Reran again, 2 failing tests.\r\n\r\nThis is all done on a clean checkout of the fork without local changes. They all seem to be in the unread posts tracking department.\r\n\r\nI am going to ignore these when writing and running the tests for my actual code, but this makes it a bit hard to see if changes made affect stuff and break things elsewhere.\r\n\r\n### 3 Failed tests:\r\n```\r\n================================== FAILURES ===================================\r\n_ TestTopicView.test_marks_the_related_topic_as_read_if_other_unread_topics_are_present _\r\n\r\nself = <tests.functional.apps.forum_conversation.test_views.TestTopicView object at 0x000001FB10E25828>\r\n\r\n    def test_marks_the_related_topic_as_read_if_other_unread_topics_are_present(self):\r\n        # Setup\r\n        new_topic = create_topic(forum=self.top_level_forum, poster=self.user)\r\n        PostFactory.create(topic=new_topic, poster=self.user)\r\n        PostFactory.create(topic=self.topic, poster=self.user)\r\n        correct_url = reverse('forum_conversation:topic', kwargs={\r\n            'forum_slug': self.top_level_forum.slug, 'forum_pk': self.top_level_forum.pk,\r\n            'slug': self.topic.slug, 'pk': self.topic.id})\r\n        # Run\r\n        self.client.get(correct_url)\r\n        # Check\r\n        topic_tracks = TopicReadTrack.objects.all()\r\n>       assert topic_tracks.count() == 1\r\nE       assert 0 == 1\r\nE        +  where 0 = <bound method QuerySet.count of <QuerySet []>>()\r\nE        +    where <bound method QuerySet.count of <QuerySet []>> = <QuerySet []>.count\r\n\r\ntests\\functional\\apps\\forum_conversation\\test_views.py:131: AssertionError\r\n_ TestTrackingHandler.test_says_that_a_topic_with_a_last_post_date_greater_than_its_mark_time_is_unread _\r\n\r\nself = <tests.unit.apps.forum_tracking.test_handler.TestTrackingHandler object at 0x000001FB11533C18>\r\n\r\n    def test_says_that_a_topic_with_a_last_post_date_greater_than_its_mark_time_is_unread(self):\r\n        # Setup\r\n        TopicReadTrackFactory.create(topic=self.topic, user=self.u2)\r\n        PostFactory.create(topic=self.topic, poster=self.u1)\r\n        # Run\r\n        unread_topics = self.tracks_handler.get_unread_topics(self.forum_2.topics.all(), self.u2)\r\n        # Check\r\n>       assert unread_topics == [self.topic, ]\r\nE       assert [] == [<Topic: It produce differen... green somebody stop skin.>]\r\nE         Right contains one more item: <Topic: It produce different market. Down know himself member task. Measure admit both green somebody stop skin.>\r\nE         Use -v to get the full diff\r\n\r\ntests\\unit\\apps\\forum_tracking\\test_handler.py:120: AssertionError\r\n________ TestForumReadTrackManager.test_can_tell_if_a_forum_is_unread _________\r\n\r\nself = <tests.unit.apps.forum_tracking.test_managers.TestForumReadTrackManager object at 0x000001FB10B27828>\r\n\r\n    def test_can_tell_if_a_forum_is_unread(self):\r\n        # Setup\r\n        PostFactory.create(topic=self.topic, poster=self.u1)\r\n        # Run\r\n        unread_forums = ForumReadTrack.objects.get_unread_forums_from_list(\r\n            self.top_level_cat_1.get_descendants(include_self=True),\r\n            self.u2)\r\n        # Check\r\n>       assert self.forum_2 in unread_forums\r\nE       assert <Forum: Teacher manage expect listen movie forget herself. Plan oil about appear compare conference.> in []\r\nE        +  where <Forum: Teacher manage expect listen movie forget herself. Plan oil about appear compare conference.> = <tests.unit.apps.forum_tracking.test_managers.TestForumReadTrackManager object at 0x000001FB10B27828>.forum_2\r\n\r\ntests\\unit\\apps\\forum_tracking\\test_managers.py:45: AssertionError\r\n============================== warnings summary ===============================\r\ntests\\unit\\models\\test_fields.py:16\r\n  C:\\_D_\\Werk\\Real Life Gaming\\Community portal\\django-machina\\tests\\unit\\models\\test_fields.py:16: PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses\r\n    from imp import reload\r\n\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_has_accessible_base_views\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_index_view_can_redirect_to_user_permissions_form\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_index_view_can_redirect_to_anonymous_user_permissions_form\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_index_view_can_redirect_to_group_permissions_form\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_form_can_update_user_permissions\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_form_can_update_anonymous_user_permissions\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_form_can_update_group_permissions\r\n  c:\\users\\brenda\\.virtualenvs\\django-machina-_lipc3zt\\lib\\site-packages\\django\\contrib\\admin\\templatetags\\admin_static.py:14: RemovedInDjango30Warning: {% load admin_static %} is deprecated in favor of {% load static %}.\r\n    RemovedInDjango30Warning,\r\n\r\n-- Docs: https://docs.pytest.org/en/latest/warnings.html\r\n============== 3 failed, 441 passed, 8 warnings in 63.83 seconds ==============\r\n```\r\n\r\n### Single failed test:\r\n```\r\n================================== FAILURES ===================================\r\n____________ TestUnreadTopicsTag.test_can_determine_unread_forums _____________\r\n\r\nself = <tests.integration.templatetags.test_tracking_tags.TestUnreadTopicsTag object at 0x000002437C079DD8>\r\n\r\n    def test_can_determine_unread_forums(self):\r\n        # Setup\r\n        def get_rendered(topics, user):\r\n            request = self.get_request()\r\n            request.user = user\r\n            ForumPermissionMiddleware().process_request(request)\r\n            t = Template(\r\n                self.loadstatement + '{% get_unread_topics topics request.user as unread_topics %}')\r\n            c = Context({'topics': topics, 'request': request})\r\n            rendered = t.render(c)\r\n\r\n            return c, rendered\r\n\r\n        # Run & check\r\n        context, rendered = get_rendered(self.forum_2.topics.all(), self.u2)\r\n        assert rendered == ''\r\n        assert set(context['unread_topics']) == set(self.forum_2.topics.all())\r\n\r\n        # forum_2 topics are now read\r\n        TopicReadTrackFactory.create(topic=self.forum_2_topic, user=self.u2)\r\n        context, rendered = get_rendered(self.forum_2.topics.all(), self.u2)\r\n        assert rendered == ''\r\n        assert not len(context['unread_topics'])\r\n\r\n        # A new post is created with a pre-existing topic track\r\n        PostFactory.create(topic=self.forum_2_topic, poster=self.u1)\r\n        context, rendered = get_rendered(self.forum_2.topics.all(), self.u2)\r\n        assert rendered == ''\r\n        assert set(context['unread_topics']) == set(self.forum_2.topics.all())\r\n\r\n        # A new post is created with a pre-existing forum track\r\n        ForumReadTrackFactory.create(forum=self.forum_1, user=self.u2)\r\n        PostFactory.create(topic=self.forum_1_topic, poster=self.u1)\r\n        context, rendered = get_rendered(self.forum_1.topics.all(), self.u2)\r\n        assert rendered == ''\r\n>       assert set(context['unread_topics']) == set(self.forum_1.topics.all())\r\nE       assert set() == {<Topic: Easy find high gi...opular effort second far.>}\r\nE         Extra items in the right set:\r\nE         <Topic: Easy find high girl. Give cover something national study cost suddenly.\\nDifficult win billion leader candidate. Blood ago create. Popular effort second far.>\r\nE         Use -v to get the full diff\r\n\r\ntests\\integration\\templatetags\\test_tracking_tags.py:104: AssertionError\r\n============================== warnings summary ===============================\r\ntests\\unit\\models\\test_fields.py:16\r\n  C:\\_D_\\Werk\\Real Life Gaming\\Community portal\\django-machina\\tests\\unit\\models\\test_fields.py:16: PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses\r\n    from imp import reload\r\n\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_has_accessible_base_views\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_index_view_can_redirect_to_user_permissions_form\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_index_view_can_redirect_to_anonymous_user_permissions_form\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_index_view_can_redirect_to_group_permissions_form\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_form_can_update_user_permissions\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_form_can_update_anonymous_user_permissions\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_form_can_update_group_permissions\r\n  c:\\users\\brenda\\.virtualenvs\\django-machina-_lipc3zt\\lib\\site-packages\\django\\contrib\\admin\\templatetags\\admin_static.py:14: RemovedInDjango30Warning: {% load admin_static %} is deprecated in favor of {% load static %}.\r\n    RemovedInDjango30Warning,\r\n\r\n-- Docs: https://docs.pytest.org/en/latest/warnings.html\r\n============== 1 failed, 443 passed, 8 warnings in 61.22 seconds ==============\r\n```\r\n\r\n### 2 Failed tests:\r\n```\r\n================================== FAILURES ===================================\r\n____________ TestUnreadTopicsTag.test_can_determine_unread_forums _____________\r\n\r\nself = <tests.integration.templatetags.test_tracking_tags.TestUnreadTopicsTag object at 0x000001F6B9E9FBA8>\r\n\r\n    def test_can_determine_unread_forums(self):\r\n        # Setup\r\n        def get_rendered(topics, user):\r\n            request = self.get_request()\r\n            request.user = user\r\n            ForumPermissionMiddleware().process_request(request)\r\n            t = Template(\r\n                self.loadstatement + '{% get_unread_topics topics request.user as unread_topics %}')\r\n            c = Context({'topics': topics, 'request': request})\r\n            rendered = t.render(c)\r\n\r\n            return c, rendered\r\n\r\n        # Run & check\r\n        context, rendered = get_rendered(self.forum_2.topics.all(), self.u2)\r\n        assert rendered == ''\r\n        assert set(context['unread_topics']) == set(self.forum_2.topics.all())\r\n\r\n        # forum_2 topics are now read\r\n        TopicReadTrackFactory.create(topic=self.forum_2_topic, user=self.u2)\r\n        context, rendered = get_rendered(self.forum_2.topics.all(), self.u2)\r\n        assert rendered == ''\r\n        assert not len(context['unread_topics'])\r\n\r\n        # A new post is created with a pre-existing topic track\r\n        PostFactory.create(topic=self.forum_2_topic, poster=self.u1)\r\n        context, rendered = get_rendered(self.forum_2.topics.all(), self.u2)\r\n        assert rendered == ''\r\n        assert set(context['unread_topics']) == set(self.forum_2.topics.all())\r\n\r\n        # A new post is created with a pre-existing forum track\r\n        ForumReadTrackFactory.create(forum=self.forum_1, user=self.u2)\r\n        PostFactory.create(topic=self.forum_1_topic, poster=self.u1)\r\n        context, rendered = get_rendered(self.forum_1.topics.all(), self.u2)\r\n        assert rendered == ''\r\n>       assert set(context['unread_topics']) == set(self.forum_1.topics.all())\r\nE       assert set() == {<Topic: Standard either s...ce line poor reduce tend.>}\r\nE         Extra items in the right set:\r\nE         <Topic: Standard either series site. Budget or each position. Billion space option party cause imagine thousand also.\\nMatter order two. Smile always notice line poor reduce tend.>\r\nE         Use -v to get the full diff\r\n\r\ntests\\integration\\templatetags\\test_tracking_tags.py:104: AssertionError\r\n_ TestForumReadTrackManager.test_tells_that_the_ancestors_of_an_unread_forum_are_also_unread _\r\n\r\nself = <tests.unit.apps.forum_tracking.test_managers.TestForumReadTrackManager object at 0x000001F6BA0D9C88>\r\n\r\n    def test_tells_that_the_ancestors_of_an_unread_forum_are_also_unread(self):\r\n        # Setup\r\n        PostFactory.create(topic=self.topic, poster=self.u1)\r\n        # Run\r\n        unread_forums = ForumReadTrack.objects.get_unread_forums_from_list(\r\n            self.top_level_cat_1.get_descendants(include_self=True),\r\n            self.u2)\r\n        # Check\r\n>       assert set(unread_forums) == set([\r\n            self.top_level_cat_1,\r\n            self.forum_2])\r\nE       assert set() == {<Forum: Fly TV history. S...e quickly speak air feel.>}\r\nE         Extra items in the right set:\r\nE         <Forum: Fly TV history. Since quickly speak air feel.>\r\nE         <Forum: Fly TV history. Since quickly speak air feel.>\r\nE         Use -v to get the full diff\r\n\r\ntests\\unit\\apps\\forum_tracking\\test_managers.py:55: AssertionError\r\n============================== warnings summary ===============================\r\ntests\\unit\\models\\test_fields.py:16\r\n  C:\\_D_\\Werk\\Real Life Gaming\\Community portal\\django-machina\\tests\\unit\\models\\test_fields.py:16: PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses\r\n    from imp import reload\r\n\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_has_accessible_base_views\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_index_view_can_redirect_to_user_permissions_form\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_index_view_can_redirect_to_anonymous_user_permissions_form\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_index_view_can_redirect_to_group_permissions_form\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_form_can_update_user_permissions\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_form_can_update_anonymous_user_permissions\r\ntests/functional/apps/forum/test_admin.py::TestForumAdmin::test_editpermission_form_can_update_group_permissions\r\n  c:\\users\\brenda\\.virtualenvs\\django-machina-_lipc3zt\\lib\\site-packages\\django\\contrib\\admin\\templatetags\\admin_static.py:14: RemovedInDjango30Warning: {% load admin_static %} is deprecated in favor of {% load static %}.\r\n    RemovedInDjango30Warning,\r\n\r\n-- Docs: https://docs.pytest.org/en/latest/warnings.html\r\n============== 2 failed, 442 passed, 8 warnings in 63.01 seconds ==============\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/ellmetha/django-machina/issues/comments/534441311","html_url":"https://github.com/ellmetha/django-machina/issues/167#issuecomment-534441311","issue_url":"https://api.github.com/repos/ellmetha/django-machina/issues/167","id":534441311,"node_id":"MDEyOklzc3VlQ29tbWVudDUzNDQ0MTMxMQ==","user":{"login":"BrendaH","id":5462600,"node_id":"MDQ6VXNlcjU0NjI2MDA=","avatar_url":"https://avatars2.githubusercontent.com/u/5462600?v=4","gravatar_id":"","url":"https://api.github.com/users/BrendaH","html_url":"https://github.com/BrendaH","followers_url":"https://api.github.com/users/BrendaH/followers","following_url":"https://api.github.com/users/BrendaH/following{/other_user}","gists_url":"https://api.github.com/users/BrendaH/gists{/gist_id}","starred_url":"https://api.github.com/users/BrendaH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrendaH/subscriptions","organizations_url":"https://api.github.com/users/BrendaH/orgs","repos_url":"https://api.github.com/users/BrendaH/repos","events_url":"https://api.github.com/users/BrendaH/events{/privacy}","received_events_url":"https://api.github.com/users/BrendaH/received_events","type":"User","site_admin":false},"created_at":"2019-09-24T08:01:01Z","updated_at":"2019-09-24T08:01:01Z","author_association":"CONTRIBUTOR","body":"I still got failed tests locally. But this might be a race condition with processes on my machine being slower.\r\nIf it can't be reproduced elsewhere it must be in my machine. It's all about timestamps if I'm correct. I was not planning on editing code concerning timestamps, so I'll just ignore these failures."}}
{"actor":{"display_login":"BrendaH"}}