{"id":21168,"library":"django-test-plus","title":"django-test-plus","description":"Useful additions to Django's default TestCase, such as shortcut assertions and improved request factory. Current version is 2.4.1, updated 2025-03, maintained by REVSYS. Release cadence is irregular, roughly 1-2 minor versions per year.","status":"active","version":"2.4.1","language":"python","source_language":"en","source_url":"https://github.com/revsys/django-test-plus/","tags":["django","testing","test-case","assertions","utilities"],"install":[{"cmd":"pip install django-test-plus","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core dependency, provides test infrastructure.","package":"django","optional":false}],"imports":[{"note":"Old import path (<1.0) was 'test_plus.test.TestCase'. Now use 'test_plus.TestCase'.","wrong":"from test_plus.test import TestCase","symbol":"TestCase","correct":"from test_plus import TestCase"}],"quickstart":{"code":"from test_plus import TestCase\n\nclass MyViewTest(TestCase):\n    def test_get(self):\n        response = self.client.get('/my-view/')\n        self.assert_200(response)\n        self.assert_contains(response, 'Hello')","lang":"python","description":"Subclass `test_plus.TestCase` to get additional assertions like `assert_200`, `assert_contains`, `get_check_200`, and improved request factory."},"warnings":[{"fix":"Upgrade to Django >= 3.2 and Python >= 3.6. Ensure your URLs include trailing slashes where expected.","message":"In v2.0, support for Django < 3.2 and Python < 3.6 was dropped. Also, the `reverse()` method no longer automatically appends trailing slashes; you must include them explicitly.","severity":"breaking","affected_versions":"<2.0"},{"fix":"Use `django.test.TransactionTestCase` or `test_plus.TestCase` with `transaction=True`.","message":"The `TransactionTestCase` class from `test_plus` is deprecated in favor of using Django's built-in `TransactionTestCase` or the `test_plus.TestCase` with appropriate database settings.","severity":"deprecated","affected_versions":">=2.0"},{"fix":"For views that redirect, use `self.client.get(url, follow=True)` or check redirect status explicitly with `assert_302` or `assert_redirects`.","message":"The `get_check_200` method (and similar) calls `self.client.get()` which does not follow redirects. If your view redirects, you need to use `self.client.get()`, `assert_redirects()` manually.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install: pip install django-test-plus. Import: from test_plus import TestCase","cause":"Package not installed or import path is wrong (e.g., using 'django_test_plus' or 'testplus').","error":"ModuleNotFoundError: No module named 'test_plus'"},{"fix":"Change class declaration to: class MyViewTest(test_plus.TestCase):","cause":"Your test class does not inherit from test_plus.TestCase, but from django.test.TestCase.","error":"AttributeError: 'MyViewTest' object has no attribute 'assert_200'"},{"fix":"Use self.client.get(url, follow=True) directly and then check status and content manually.","cause":"You passed 'follow=True' to get_check_200 or post_check_200 methods; they don't support that parameter.","error":"TypeError: __init__() got an unexpected keyword argument 'follow'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}