Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests interrogating self.client.get() return value's context member triggers "Instance of 'WSGIRequest' has no 'context' member (no-member)" #78

Closed
craiga opened this issue Jun 22, 2016 · 2 comments
Assignees

Comments

@craiga
Copy link

craiga commented Jun 22, 2016

The following test code:

response = self.client.get(self.url)
self.assertEqual(response.context['object'], expected_object)

…causes the following pylint message:

E:256,52: Instance of 'WSGIRequest' has no 'context' member (no-member)

pylint==1.5.6 and pylint-django==0.7.2.

@craiga
Copy link
Author

craiga commented Jun 22, 2016

I wrote a test case for this, but haven't had time to fix it.

"""
Checks that Pylint does not complain about a standard test.
"""

from django.test import TestCase
from django.db import models


class SomeModel(models.Model):
    """Just a model."""
    pass


class SomeTestCase(TestCase):
    """A test cast."""
    def test_thing(self):
        """Test a thing."""
        expected_object = SomeModel()
        response = self.client.get('/get/some/thing/')
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.context['object'], expected_object)

@raymondberg
Copy link

I just ran into this today. Would love a fix!

@atodorov atodorov self-assigned this Apr 5, 2018
atodorov added a commit that referenced this issue Apr 6, 2018
The test can't reproduce the original problem reported in the issue
so consider it resolved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants