revsys / django-test-plus

Useful additions to Django's default TestCase

Home Page:https://django-test-plus.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

assertTrue fails when used with pytest tp fixture

jsolum opened this issue · comments

I am using pytest and trying to use the tp fixture, but I am running into this error on certain methods: AttributeError: 'TestCase' object has no attribute 'assertTrue'.

Here is my trace:

    def test_thing(tp):
        response = tp.get('test-url')
>       tp.assertInContext("foo")

test-project/test-app/tests/my_test.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <test_plus.plugin.TestCase object at 0x107a9ab80>, key = 'requests'

    def assertInContext(self, key):
        if self.last_response is not None:
>           self.assertTrue(key in self.last_response.context)
E           AttributeError: 'TestCase' object has no attribute 'assertTrue'

.venv/lib/python3.8/site-packages/test_plus/test.py:324: AttributeError
=========================================================================== short test summary info ===========================================================================
FAILED test-project/test-app/tests/my_test.py::test_thing - AttributeError: 'TestCase' object has no attribute 'assertTrue'

Not every method runs into this issue. For example assertLoginRequired works.

Thank you for reporting the issue. This should be fixed in #178