diff options
author | Chris Lamb <chris@chris-lamb.co.uk> | 2016-01-24 10:06:01 +0100 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2016-01-25 12:39:06 -0500 |
commit | abc0777b63057e2ff97eee2ff184356051e14c47 (patch) | |
tree | 4b879db7e88d6bd5ce7f810d62d0dd287d493b9d /tests/project_template | |
parent | 9c43d8252a926f72be5a279186b42848501819b8 (diff) | |
download | django-abc0777b63057e2ff97eee2ff184356051e14c47.tar.gz |
Fixed #25968 -- Changed project/app templates to use a "py-tpl" suffix.
Debian packages unconditionally byte-compile .py files on installation and
do not silence errors by design. Therefore, we need a way of shipping these
invalid .py files without a .py extension but ensuring that when we
template them, they end up as .py.
We don't special-case .py files so that the all the TemplateCommand
command-line options (eg. extra_files and extensions) still work entirely
as expected and it may even be useful for other formats too.
Diffstat (limited to 'tests/project_template')
-rw-r--r-- | tests/project_template/test_settings.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/project_template/test_settings.py b/tests/project_template/test_settings.py index ac115f7dc2..25a95717a9 100644 --- a/tests/project_template/test_settings.py +++ b/tests/project_template/test_settings.py @@ -1,13 +1,28 @@ +import os +import shutil import unittest +from django import conf from django.test import TestCase from django.utils import six +from django.utils._os import upath @unittest.skipIf(six.PY2, 'Python 2 cannot import the project template because ' 'django/conf/project_template doesn\'t have an __init__.py file.') class TestStartProjectSettings(TestCase): + def setUp(self): + # Ensure settings.py exists + project_dir = os.path.join( + os.path.dirname(upath(conf.__file__)), + 'project_template', + 'project_name', + ) + template_settings_py = os.path.join(project_dir, 'settings.py-tpl') + test_settings_py = os.path.join(project_dir, 'settings.py') + shutil.copyfile(template_settings_py, test_settings_py) + self.addCleanup(os.remove, test_settings_py) def test_middleware_classes_headers(self): """ |