def setup(self):
        TempDirHelper.setup(self)

        self.loader = DjangoLoader()
        settings.TEMPLATES[0]['OPTIONS'] = {
            'loaders': ('django.template.loaders.filesystem.Loader'),
        }
        settings.TEMPLATES[0]['DIRS'] = [self.tempdir]
示例#2
0
    def setup(self):
        TempDirHelper.setup(self)

        self.loader = DjangoLoader()
        settings.TEMPLATE_LOADERS = [
            'django.template.loaders.filesystem.Loader',
        ]
        settings.TEMPLATE_DIRS = [self.tempdir]
示例#3
0
    def setup(self):
        TempDirHelper.setup(self)

        self.loader = DjangoLoader()
        settings.TEMPLATE_LOADERS = [
            'django.template.loaders.filesystem.Loader',
        ]
        settings.TEMPLATE_DIRS = [self.tempdir]
    def tearDown(self):
        TempDirHelper.teardown(self)
        testing.tearDown()

        import sys
        # remove tempdir path elements
        for pth in sys.path:
            if pth.startswith(self.tempdir):
                sys.path.remove(pth)

        # remove tempdir modules
        for name, module in sys.modules.items():
            if module is not None:
                if getattr(module, '__file__', '').startswith(self.tempdir):
                    del sys.modules[name]
    def tearDown(self):
        TempDirHelper.teardown(self)
        testing.tearDown()

        import sys
        # remove tempdir path elements
        for pth in sys.path:
            if pth.startswith(self.tempdir):
                sys.path.remove(pth)

        # remove tempdir modules
        for name,module in sys.modules.items():
            if module is not None:
                if getattr(module, '__file__', '').startswith(self.tempdir):
                    del sys.modules[name]
    def setUp(self):
        from pyramid_webassets import get_webassets_env

        TempDirHelper.setup(self)

        self.request = testing.DummyRequest()
        self.config = testing.setUp(request=self.request, settings={
                'webassets.base_url': '/static',
                'webassets.base_dir': self.tempdir+'/static'})
        self.config.include('pyramid_webassets')

        self.env = get_webassets_env(self.config)
        # Disable cache busting
        self.env.url_expire = False

        import sys
        sys.path.append(self.tempdir)
示例#7
0
 def test_external_refs(self):
     """If a bundle contains absolute paths outside of the
     media directory, to generate a url they are copied in.
     """
     self.env.debug = True
     with TempDirHelper() as h:
         h.create_files(['foo.css'])
         bundle = self.mkbundle(h.path('foo.css'))
         urls = bundle.urls()
         assert len(urls) == 1
         assert re.match(r'.*/webassets-external/[\da-z]*_foo.css', urls[0])
    def setup(self):
        TempDirHelper.setup(self)

        # Reset the webassets environment.
        django_env_reset()
        self.env = get_env()

        # Use a temporary directory as MEDIA_ROOT
        settings.MEDIA_ROOT = self.create_directories('media')[0]
        settings.STATIC_ROOT = None

        # Some other settings without which we are likely to run
        # into errors being raised as part of validation.
        setattr(settings, 'DATABASES', {})
        settings.DATABASES['default'] = {'ENGINE': ''}

        # Unless we explicitly test it, we don't want to use the cache during
        # testing.
        self.env.cache = False
        self.env.manifest = False
示例#9
0
    def setup(self):
        TempDirHelper.setup(self)

        # Reset the webassets environment.
        django_env_reset()
        self.env = get_env()

        # Use a temporary directory as MEDIA_ROOT
        settings.MEDIA_ROOT = self.create_directories('media')[0]
        settings.STATIC_ROOT = None

        # Some other settings without which we are likely to run
        # into errors being raised as part of validation.
        setattr(settings, 'DATABASES', {})
        settings.DATABASES['default'] = {'ENGINE': ''}

        # Unless we explicitly test it, we don't want to use the cache during
        # testing.
        self.env.cache = False
        self.env.manifest = False
示例#10
0
 def test_external_refs(self):
     """If a bundle contains absolute paths outside of the
     media directory, to generate a url they are copied in.
     """
     try:
         from nose.tools import assert_regex
     except ImportError:
         raise SkipTest("Assertion method only present in 2.7+")
     self.env.debug = True
     with TempDirHelper() as h:
         h.create_files(['foo.css'])
         bundle = self.mkbundle(h.path('foo.css'))
         urls = bundle.urls()
         assert len(urls) == 1
         assert_regex(urls[0], r'.*/webassets-external/[\da-z]*_foo.css')