Пример #1
0
    def test_import_works(self):
        # assert default settings not changed before import
        self.assertEqual(settings.KIWI_VERSION, __version__)
        self.assertIsNone(getattr(settings, 'KIWI_MARKETPLACE', None))
        self.assertNotIn('test_me', settings.INSTALLED_APPS)

        # perform the import which will override settings
        import_local_settings(os.path.dirname(local_settings_test.__file__),
                              scope=settings.__dict__)

        # assert settings values have changed
        self.assertEqual(settings.KIWI_VERSION, "%s-Under-Test" % __version__)
        self.assertEqual(settings.KIWI_MARKETPLACE, 'newly-added-setting')
        self.assertIn('test_me', settings.INSTALLED_APPS)
Пример #2
0
# pylint: disable=wildcard-import, unused-wildcard-import
"""
    Django settings for product env.
"""

import os

from tcms.settings.common import *  # noqa: F401,F403
from tcms.utils.settings import import_local_settings

# Debug settings
DEBUG = False

try:
    from .local_settings import *  # noqa: F401,F403
except ImportError:
    pass

try:
    import tcms_settings_dir
    import_local_settings(os.path.dirname(tcms_settings_dir.__file__))
except ImportError:
    pass
Пример #3
0
# pylint: disable=wildcard-import, unused-wildcard-import
"""
    Django settings for product env.
"""

from .common import *  # noqa: F401,F403

from tcms.utils.settings import import_local_settings

# Debug settings
DEBUG = False

try:
    from .local_settings import *  # noqa: F401,F403
except ImportError:
    pass

import_local_settings('local_settings_dir')