diff --git a/horizon/test/helpers.py b/horizon/test/helpers.py index 5fcf58ee83..712c4899ff 100644 --- a/horizon/test/helpers.py +++ b/horizon/test/helpers.py @@ -35,6 +35,7 @@ from django.test.client import RequestFactory # noqa from django.test import testcases from django.utils.encoding import force_text from django.utils import unittest +import six if django.VERSION < (1, 7): from django.test import LiveServerTestCase # noqa @@ -169,6 +170,14 @@ class TestCase(django_test.TestCase): if hasattr(self.user, "_perm_cache"): del self.user._perm_cache + if six.PY3: + # Python 2 assert methods renamed in Python 3 + def assertItemsEqual(self, expected_seq, actual_seq, msg=None): + self.assertCountEqual(expected_seq, actual_seq, msg) + + def assertNotRegexpMatches(self, text, unexpected_regexp, msg=None): + self.assertNotRegex(text, unexpected_regexp, msg) + def assertNoMessages(self, response=None): """Asserts that no messages have been attached by the ``contrib.messages`` framework. diff --git a/tox.ini b/tox.ini index 1161049715..1c31f2e7bb 100644 --- a/tox.ini +++ b/tox.ini @@ -24,6 +24,7 @@ commands = python manage.py test --settings=horizon.test.settings \ horizon.test.tests.base \ horizon.test.tests.forms \ + horizon.test.tests.messages \ horizon.test.tests.middleware \ horizon.test.tests.tables.DataTableViewTests \ horizon.test.tests.templatetags \