From 6963c5307bb20e67161f17444120aced9ccf1330 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Thu, 2 Jun 2016 10:24:41 -0400 Subject: [PATCH] Deactivate translations after all i18n tests in courseware so that they don't leak to future tests --- lms/djangoapps/courseware/tests/test_i18n.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lms/djangoapps/courseware/tests/test_i18n.py b/lms/djangoapps/courseware/tests/test_i18n.py index 345dc21dda..4f8599eafd 100644 --- a/lms/djangoapps/courseware/tests/test_i18n.py +++ b/lms/djangoapps/courseware/tests/test_i18n.py @@ -9,6 +9,7 @@ from django.contrib.auth.models import User from django.core.urlresolvers import reverse, NoReverseMatch from django.test import TestCase from django.test.client import Client +from django.utils import translation from dark_lang.models import DarkLangConfig from lang_pref import LANGUAGE_KEY @@ -21,6 +22,10 @@ class BaseI18nTestCase(TestCase): Base utilities for i18n test classes to derive from """ + def setUp(self): + super(BaseI18nTestCase, self).setUp() + self.addCleanup(translation.deactivate) + def assert_tag_has_attr(self, content, tag, attname, value): """Assert that a tag in `content` has a certain value in a certain attribute.""" regex = r"""<{tag} [^>]*\b{attname}=['"]([\w\d\- ]+)['"][^>]*>""".format(tag=tag, attname=attname)