-
Notifications
You must be signed in to change notification settings - Fork 346
Support for SimpleTestCase.assertTemplateUsed etc #97
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
Comments
There's an easy way to achieve that:
Just replace unittest.TestCase with SimpleTestCase. This makes all methods from TestCase available on the pytest namespace (you can do pytest.assertAlmostEqual(), pytest.assertTemplateUsed() etc). |
@rafales This should get added to http://pytest-django.readthedocs.org/en/latest/helpers.html. |
Hmm, I think this should be namespaced somehow, like
Also, generic helpers such as assertAlmostEqual might be nice to have, but it is not really the job of pytest-django to provide them. |
Some more ideas: it should be possible to introspect SimpleTestCase and only add the assertion methods that are defined exactly at SimpleTestCase and not in its super classes. |
I've tried to make PR #144 work opening the new PR #232, where I also merged in the current Currently, the code doesn't seem to provide the I'm wondering whether the code in the original PR ever worked. GitHub reports it did (via Travis-CI integration), but the related test runs don't exist on Travis-CI. 😟 |
@bittner |
Closing this in favor of #232 (which is a continuation of this one). |
Expanded namespace of pytest Reference: pytest-dev/pytest-django#97 pytest-dev/pytest-django#232
) Fixes #97. Co-authored-by: Daniel Hahler <[email protected]>
…709) Fixes pytest-dev/pytest-django#97. Co-authored-by: Daniel Hahler <[email protected]>
I wonder if there is currently a way to use e.g. methods like assertTemplateUsed from Django's SimpleTestCase with pytest-django directly.
I know that I could use a standard SimpleTestCase, but maybe I am just missing something.
What would be the approach to get things like this into pytest-django, if this would be desired?
The text was updated successfully, but these errors were encountered: