diff options
| author | Tim Graham <timograham@gmail.com> | 2015-02-14 19:47:07 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-02-17 19:05:31 -0500 |
| commit | 2aa06e439a29a1c24fa03744395cc57787e7198e (patch) | |
| tree | 81b1a3e9bd7ef374521fc46be17d15e1f50a37c5 /tests/test_runner | |
| parent | 09da1b465ea8ba9ecb99b1cd02a689bb831d0e1b (diff) | |
[1.8.x] Refs #24324 -- Fixed Python 2 test failures when path to Django source contains non-ASCII characters.
Backport of 307c0f299a6c26f5231d3516df5b4edc54b36553 from master
Diffstat (limited to 'tests/test_runner')
| -rw-r--r-- | tests/test_runner/test_debug_sql.py | 6 | ||||
| -rw-r--r-- | tests/test_runner/tests.py | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/tests/test_runner/test_debug_sql.py b/tests/test_runner/test_debug_sql.py index cc583cbb37..fa7c7f7401 100644 --- a/tests/test_runner/test_debug_sql.py +++ b/tests/test_runner/test_debug_sql.py @@ -5,6 +5,7 @@ from django.db import connection from django.test import TestCase from django.test.runner import DiscoverRunner from django.utils import six +from django.utils.encoding import force_text from .models import Person @@ -42,8 +43,9 @@ class TestDebugSQL(unittest.TestCase): ).run(suite) runner.teardown_databases(old_config) - stream.seek(0) - return stream.read() + if six.PY2: + stream.buflist = [force_text(x) for x in stream.buflist] + return stream.getvalue() def test_output_normal(self): full_output = self._test_output(1) diff --git a/tests/test_runner/tests.py b/tests/test_runner/tests.py index d94d264321..f880d4a56c 100644 --- a/tests/test_runner/tests.py +++ b/tests/test_runner/tests.py @@ -18,6 +18,7 @@ from django.test import ( from django.test.runner import DiscoverRunner, dependency_ordered from django.test.testcases import connections_support_transactions from django.utils import six +from django.utils.encoding import force_text from .models import Person @@ -391,7 +392,7 @@ class DeprecationDisplayTest(AdminScriptTestCase): def test_runner_deprecation_verbosity_default(self): args = ['test', '--settings=test_project.settings', 'test_runner_deprecation_app'] out, err = self.run_django_admin(args) - self.assertIn("Ran 1 test", err) + self.assertIn("Ran 1 test", force_text(err)) six.assertRegex(self, err, r"RemovedInDjango\d\dWarning: warning from test") six.assertRegex(self, err, r"RemovedInDjango\d\dWarning: module-level warning from deprecation_app") |
