diff options
| author | Claude Paroz <claude@2xlibre.net> | 2012-12-08 11:13:52 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2012-12-08 11:13:52 +0100 |
| commit | c91667338a4e774e2819ccf4da852dc7b759bc19 (patch) | |
| tree | 42a700d237c85ac2b647999d02d3dcd7d8047068 /tests/regressiontests/admin_scripts | |
| parent | 53b879f045f0e55cc8f4bedff67b5a14f3057561 (diff) | |
Fixed #19357 -- Allow non-ASCII chars in filesystem paths
Thanks kujiu for the report and Aymeric Augustin for the review.
Diffstat (limited to 'tests/regressiontests/admin_scripts')
| -rw-r--r-- | tests/regressiontests/admin_scripts/tests.py | 15 | ||||
| -rw-r--r-- | tests/regressiontests/admin_scripts/urls.py | 3 |
2 files changed, 12 insertions, 6 deletions
diff --git a/tests/regressiontests/admin_scripts/tests.py b/tests/regressiontests/admin_scripts/tests.py index a26d7a6eaa..d0ca9d26df 100644 --- a/tests/regressiontests/admin_scripts/tests.py +++ b/tests/regressiontests/admin_scripts/tests.py @@ -19,13 +19,15 @@ from django.conf import settings from django.db import connection from django.test.simple import DjangoTestSuiteRunner from django.utils import unittest +from django.utils.encoding import force_str, force_text +from django.utils._os import upath from django.test import LiveServerTestCase -test_dir = os.path.dirname(os.path.dirname(__file__)) +test_dir = os.path.dirname(os.path.dirname(upath(__file__))) class AdminScriptTestCase(unittest.TestCase): def write_settings(self, filename, apps=None, is_dir=False, sdict=None): - test_dir = os.path.dirname(os.path.dirname(__file__)) + test_dir = os.path.dirname(os.path.dirname(upath(__file__))) if is_dir: settings_dir = os.path.join(test_dir, filename) os.mkdir(settings_dir) @@ -94,6 +96,7 @@ class AdminScriptTestCase(unittest.TestCase): return paths def run_test(self, script, args, settings_file=None, apps=None): + test_dir = os.path.dirname(os.path.dirname(__file__)) project_dir = os.path.dirname(test_dir) base_dir = os.path.dirname(project_dir) ext_backend_base_dirs = self._ext_backend_paths() @@ -134,7 +137,7 @@ class AdminScriptTestCase(unittest.TestCase): return out, err def run_django_admin(self, args, settings_file=None): - bin_dir = os.path.abspath(os.path.dirname(bin.__file__)) + bin_dir = os.path.abspath(os.path.dirname(upath(bin.__file__))) return self.run_test(os.path.join(bin_dir, 'django-admin.py'), args, settings_file) def run_manage(self, args, settings_file=None): @@ -144,7 +147,7 @@ class AdminScriptTestCase(unittest.TestCase): except OSError: pass - conf_dir = os.path.dirname(conf.__file__) + conf_dir = os.path.dirname(upath(conf.__file__)) template_manage_py = os.path.join(conf_dir, 'project_template', 'manage.py') test_manage_py = os.path.join(test_dir, 'manage.py') @@ -166,10 +169,12 @@ class AdminScriptTestCase(unittest.TestCase): def assertOutput(self, stream, msg): "Utility assertion: assert that the given message exists in the output" + stream = force_text(stream) self.assertTrue(msg in stream, "'%s' does not match actual output text '%s'" % (msg, stream)) def assertNotInOutput(self, stream, msg): "Utility assertion: assert that the given message doesn't exist in the output" + stream = force_text(stream) self.assertFalse(msg in stream, "'%s' matches actual output text '%s'" % (msg, stream)) ########################################################################## @@ -1553,7 +1558,7 @@ class StartProject(LiveServerTestCase, AdminScriptTestCase): self.assertNoOutput(err) test_manage_py = os.path.join(testproject_dir, 'manage.py') with open(test_manage_py, 'r') as fp: - content = fp.read() + content = force_text(fp.read()) self.assertIn("project_name = 'another_project'", content) self.assertIn("project_directory = '%s'" % testproject_dir, content) diff --git a/tests/regressiontests/admin_scripts/urls.py b/tests/regressiontests/admin_scripts/urls.py index 692638ceca..a45dc3e9a6 100644 --- a/tests/regressiontests/admin_scripts/urls.py +++ b/tests/regressiontests/admin_scripts/urls.py @@ -1,7 +1,8 @@ import os from django.conf.urls import patterns +from django.utils._os import upath -here = os.path.dirname(__file__) +here = os.path.dirname(upath(__file__)) urlpatterns = patterns('', (r'^custom_templates/(?P<path>.*)$', 'django.views.static.serve', { |
