Exemplo n.º 1
0
 def setup(self):
     try:
         import scss
         self.scss = scss
     except ImportError:
         raise SkipTest()
     TempEnvironmentHelper.setup(self)
Exemplo n.º 2
0
    def setup(self):
        TempEnvironmentHelper.setup(self)

        class MyCache(BaseCache):
            def __init__(self):
                self.enabled = False
                self.reset()
            def get(self, key):
                self.getops += 1
                if self.enabled:
                    return 'foo'
                return False
            def set(self, key, data):
                self.setops += 1
            def reset(self):
                self.getops = 0
                self.setops = 0

        class CompleteFilter(Filter):
            # Support all possible filter operations
            def input(self, *a, **kw):
                pass
            output = open = concat = input
        self.filter = CompleteFilter

        self.env.cache = self.cache = MyCache()
        self.env.manifest = None
        # Note that updater will use the cache also
        self.env.updater = TimestampUpdater()
Exemplo n.º 3
0
    def setup(self):
        try:
            import closure
        except ImportError:
            raise SkipTest()

        TempEnvironmentHelper.setup(self)
Exemplo n.º 4
0
    def setup(self):
        try:
            import closure
        except ImportError:
            raise SkipTest()

        TempEnvironmentHelper.setup(self)
Exemplo n.º 5
0
    def setup(self):
        TempEnvironmentHelper.setup(self)

        # Test the timestamp updater with cache disabled, so that the
        # BundleDefUpdater() base class won't interfere.
        self.env.cache = False
        self.env.updater = self.updater = TimestampUpdater()
Exemplo n.º 6
0
    def setup(self):
        TempEnvironmentHelper.setup(self)

        class MyCache(BaseCache):
            def __init__(self):
                self.enabled = False
                self.reset()

            def get(self, key):
                self.getops += 1
                if self.enabled:
                    return 'foo'
                return False

            def set(self, key, data):
                self.setops += 1

            def reset(self):
                self.getops = 0
                self.setops = 0

        class CompleteFilter(Filter):
            # Support all possible filter operations
            def input(self, *a, **kw):
                pass

            output = open = concat = input

        self.filter = CompleteFilter

        self.env.cache = self.cache = MyCache()
        self.env.manifest = None
        # Note that updater will use the cache also
        self.env.updater = TimestampUpdater()
Exemplo n.º 7
0
 def setup(self):
     try:
         import scss
         self.scss = scss
     except ImportError:
         raise SkipTest()
     TempEnvironmentHelper.setup(self)
Exemplo n.º 8
0
    def setup(self):
        TempEnvironmentHelper.setup(self)

        class CustomUpdater(BaseUpdater):
            allow = True
            def needs_rebuild(self, *a, **kw):
                return self.allow
        self.m.updater = CustomUpdater()
Exemplo n.º 9
0
    def setup(self):
        TempEnvironmentHelper.setup(self)

        class CustomUpdater(BaseUpdater):
            allow = True

            def needs_rebuild(self, *a, **kw):
                return self.allow

        self.m.updater = CustomUpdater()
Exemplo n.º 10
0
    def setup(self):
        TempEnvironmentHelper.setup(self)

        self.m.expire = False

        self.build_called = build_called = []
        env = self.m
        class MockBundle(Bundle):
            def __init__(self, *a, **kw):
                Bundle.__init__(self, *a, **kw)
                self.env = env
            def _build(self, *a, **kw):
                build_called.append(self.output)
        self.MockBundle = MockBundle
Exemplo n.º 11
0
    def setup(self):
        TempEnvironmentHelper.setup(self)

        self.app = Flask(__name__, static_path='/app_static')
        import test_module
        if not Blueprint:
            self.module = Module(test_module.__name__, name='module',
                                 static_path='/mod_static')
            self.app.register_module(self.module)
        else:
            self.blueprint = Blueprint('module', test_module.__name__,
                                       static_url_path='/mod_static',
                                       static_folder='static')
            self.app.register_blueprint(self.blueprint)
        self.env = Environment(self.app)
Exemplo n.º 12
0
    def setup(self):
        TempEnvironmentHelper.setup(self)

        self.m.expire = False

        self.build_called = build_called = []
        env = self.m

        class MockBundle(Bundle):
            def __init__(self, *a, **kw):
                Bundle.__init__(self, *a, **kw)
                self.env = env

            def _build(self, *a, **kw):
                build_called.append(self.output)

        self.MockBundle = MockBundle
Exemplo n.º 13
0
    def setup(self):
        TempEnvironmentHelper.setup(self)

        class MyCache(BaseCache):
            def __init__(self):
                self.enabled = False
                self.reset()
            def get(self, key):
                self.getops += 1
                if self.enabled:
                    return 'foo'
                return False
            def set(self, key, data):
                self.setops += 1
            def reset(self):
                self.getops = 0
                self.setops = 0

        self.m.cache = self.cache = MyCache()
        # Note that updater will use the cache also
        self.m.updater = 'timestamp'
Exemplo n.º 14
0
def test_callable_filter():
    """Simple callables can be used as filters.

    Regression: Ensure that they actually work.
    """
    # Note how this filter specifically does not receive any **kwargs.
    def my_filter(_in, out):
        assert _in.read() == 'initial value'
        out.write('filter was here')
    with TempEnvironmentHelper() as helper:
        helper.create_files({'in': 'initial value'})
        b = helper.mkbundle('in', filters=my_filter, output='out')
        b.build()
        assert helper.get('out') == 'filter was here'
Exemplo n.º 15
0
 def setup(self):
     try:
         import cssprefixer
     except ImportError:
         raise SkipTest()
     TempEnvironmentHelper.setup(self)
Exemplo n.º 16
0
 def setup(self):
     try:
         import cssprefixer
     except ImportError:
         raise SkipTest()
     TempEnvironmentHelper.setup(self)
Exemplo n.º 17
0
 def setup(self):
     TempEnvironmentHelper.setup(self)
     self.env.updater = False
     self.env.directory = self.path('dir')
     self.env.debug = True
Exemplo n.º 18
0
 def setup(self):
     TempEnvironmentHelper.setup(self)
     mock_opener = urllib2.build_opener(MockHTTPHandler({
         'http://foo': 'function() {}'}))
     urllib2.install_opener(mock_opener)
Exemplo n.º 19
0
 def setup(self):
     try:
         import closure_soy
     except:
         raise SkipTest()
     TempEnvironmentHelper.setup(self)
Exemplo n.º 20
0
 def setup(self):
     TempEnvironmentHelper.setup(self)
     mock_opener = urllib2.build_opener(
         MockHTTPHandler({'http://foo': 'function() {}'}))
     urllib2.install_opener(mock_opener)
Exemplo n.º 21
0
 def setup(self):
     if not find_executable('r.js'):
         raise SkipTest('"r.js" executable not found')
     TempEnvironmentHelper.setup(self)
     self.env.config['requirejs_config'] = self.path('requirejs.json')
     self.env.config['requirejs_baseUrl'] = self.path('')
Exemplo n.º 22
0
 def setup(self):
     TempEnvironmentHelper.setup(self)
Exemplo n.º 23
0
 def setup(self):
     if not find_executable('compass'):
         raise SkipTest()
     TempEnvironmentHelper.setup(self)
Exemplo n.º 24
0
 def setup(self):
     if not find_executable("coffee"):
         raise SkipTest()
     TempEnvironmentHelper.setup(self)
Exemplo n.º 25
0
 def setup(self):
     if not find_executable("handlebars"):
         raise SkipTest()
     TempEnvironmentHelper.setup(self)
Exemplo n.º 26
0
 def setup(self):
     if not find_executable('compass'):
         raise SkipTest()
     TempEnvironmentHelper.setup(self)
Exemplo n.º 27
0
 def setup(self):
     TempEnvironmentHelper.setup(self)
Exemplo n.º 28
0
 def setup(self):
     TempEnvironmentHelper.setup(self)
     self.env.updater = False
     self.env.directory = self.path('dir')
     self.env.debug = True