summaryrefslogtreecommitdiff
path: root/docs/topics/testing
diff options
context:
space:
mode:
Diffstat (limited to 'docs/topics/testing')
-rw-r--r--docs/topics/testing/tools.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index f3e5ec982f..82fa4116f9 100644
--- a/docs/topics/testing/tools.txt
+++ b/docs/topics/testing/tools.txt
@@ -685,6 +685,14 @@ or by including the ``Accept-Language`` HTTP header in the request::
response = self.client.get("/", headers={"accept-language": "fr"})
self.assertEqual(response.content, b"Bienvenue sur mon site.")
+.. note::
+
+ When using these methods, ensure to reset the active language at the end of
+ each test::
+
+ def tearDown(self):
+ translation.activate(settings.LANGUAGE_CODE)
+
More details are in :ref:`how-django-discovers-language-preference`.
If the middleware isn't enabled, the active language may be set using