当前位置: 首页>>代码示例>>Python>>正文


Python pyramid_webassets.get_webassets_env_from_settings函数代码示例

本文整理汇总了Python中pyramid_webassets.get_webassets_env_from_settings函数的典型用法代码示例。如果您正苦于以下问题:Python get_webassets_env_from_settings函数的具体用法?Python get_webassets_env_from_settings怎么用?Python get_webassets_env_from_settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_webassets_env_from_settings函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_webassets_env_from_settings_no_base_dir

    def test_get_webassets_env_from_settings_no_base_dir(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {'webassets.base_url': '/static'}

        with self.assertRaises(Exception) as cm:
            get_webassets_env_from_settings(settings)

        assert cm.exception.message == "You need to provide webassets.base_dir in your configuration"
开发者ID:sekimura,项目名称:pyramid_webassets,代码行数:9,代码来源:test_webassets.py

示例2: test_get_webassets_env_from_settings_no_base_url

    def test_get_webassets_env_from_settings_no_base_url(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {'webassets.base_dir': '/home'}

        with self.assertRaises(Exception) as cm:
            get_webassets_env_from_settings(settings)

        assert str(cm.exception) == "You need to provide webassets.base_url in your configuration"
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:9,代码来源:test_webassets.py

示例3: test_get_webassets_env_from_settings_prefix_bad_change

    def test_get_webassets_env_from_settings_prefix_bad_change(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'foo.base_url': 'static',
            'foo.base_dir': os.getcwd(),
        }

        with self.assertRaises(Exception) as cm:
            get_webassets_env_from_settings(settings, prefix='webassets')

        assert str(cm.exception) == "You need to provide webassets.base_dir in your configuration"
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:12,代码来源:test_webassets.py

示例4: test_get_webassets_env_from_settings_prefix_bad_change

    def test_get_webassets_env_from_settings_prefix_bad_change(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'foo.base_url': '/static',
            'foo.base_dir': '/home/sontek',
        }

        with self.assertRaises(Exception) as cm:
            get_webassets_env_from_settings(settings, prefix='webassets')

        assert cm.exception.message == "You need to provide webassets.base_dir in your configuration"
开发者ID:0x1997,项目名称:pyramid_webassets,代码行数:12,代码来源:test_webassets.py

示例5: test_bundles_yamlloader_asset

 def test_bundles_yamlloader_asset(self):
     try:
         import yaml
     except ImportError:
         raise unittest.SkipTest('PyYAML not installed')
     from pyramid_webassets import get_webassets_env_from_settings
     settings = {
         'webassets.base_url': 'static',
         'webassets.base_dir': os.getcwd(),
         'webassets.bundles': (
             'dotted.package.name:foo/bar.yaml\n'
             'dotted.package.name:foo/baz.yaml'
         ),
     }
     self.create_files({
         'dotted/__init__.py': '',
         'dotted/package/__init__.py': '',
         'dotted/package/name/__init__.py': '',
         'dotted/package/name/foo/bar.yaml': (
             'mycss: {contents: style/mycssoverride.css}'
         ),
         'dotted/package/name/foo/baz.yaml': (
             'mycss: {contents: style/mycss.css}\n'
             'myjs: {contents: js/myjs.js}'
         ),
     })
     env = get_webassets_env_from_settings(settings)
     self.assertEqual(env.config.get('bundles'), None)
     self.assertIsNotNone(env['mycss'])
     self.assertEqual(sorted(env._named_bundles.keys()), ['mycss', 'myjs'])
     self.assertIn('style/mycssoverride.css', env['mycss'].contents)
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:31,代码来源:test_webassets.py

示例6: test_auto_bool

 def test_auto_bool(self):
     from pyramid_webassets import get_webassets_env_from_settings
     settings = {
         'webassets.base_url': 'static',
         'webassets.base_dir': os.getcwd(),
         'webassets.less_run_in_debug': 'true',
     }
     env = get_webassets_env_from_settings(settings)
     assert env.config['less_run_in_debug'] is True
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:9,代码来源:test_webassets.py

示例7: test_auto_json

 def test_auto_json(self):
     from pyramid_webassets import get_webassets_env_from_settings
     settings = {
         'webassets.base_url': 'static',
         'webassets.base_dir': os.getcwd(),
         'webassets.less_extra_args': 'json:["--foo", "--bar"]',
     }
     env = get_webassets_env_from_settings(settings)
     assert env.config['less_extra_args'] == ['--foo', '--bar']
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:9,代码来源:test_webassets.py

示例8: test_get_webassets_env_from_settings_load_path

    def test_get_webassets_env_from_settings_load_path(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': 'static',
            'webassets.base_dir': os.getcwd(),
            'webassets.load_path': '/foo bar/\nbaz'
        }

        env = get_webassets_env_from_settings(settings)

        assert env.load_path == ['/foo', 'bar/', 'baz']
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:12,代码来源:test_webassets.py

示例9: test_get_webassets_env_from_settings_minimal

    def test_get_webassets_env_from_settings_minimal(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': '/static',
            'webassets.base_dir': os.getcwd(),
        }

        env = get_webassets_env_from_settings(settings)

        assert env.directory == settings['webassets.base_dir']
        assert env.url == settings['webassets.base_url']
开发者ID:Happystation,项目名称:pyramid_webassets,代码行数:12,代码来源:test_webassets.py

示例10: test_get_webassets_env_from_settings_with_cache

    def test_get_webassets_env_from_settings_with_cache(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': '/static',
            'webassets.base_dir': '/home/sontek',
            'webassets.cache': 'true',
        }

        env = get_webassets_env_from_settings(settings)

        assert env.cache != None
开发者ID:0x1997,项目名称:pyramid_webassets,代码行数:12,代码来源:test_webassets.py

示例11: test_get_webassets_env_from_settings_with_cache

    def test_get_webassets_env_from_settings_with_cache(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': 'static',
            'webassets.base_dir': os.getcwd(),
            'webassets.cache': 'true',
        }

        env = get_webassets_env_from_settings(settings)

        assert env.cache is not None
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:12,代码来源:test_webassets.py

示例12: test_get_webassets_env_from_settings_asset_spec_dir

    def test_get_webassets_env_from_settings_asset_spec_dir(self):
        import pyramid_webassets
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': 'static',
            'webassets.base_dir': 'pyramid_webassets:static',
        }

        env = get_webassets_env_from_settings(settings)
        expected = os.path.join(pyramid_webassets.__path__[0], 'static')

        assert env.directory == expected
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:13,代码来源:test_webassets.py

示例13: test_get_webassets_env_from_settings_prefix_change

    def test_get_webassets_env_from_settings_prefix_change(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'foo.base_url': '/static',
            'foo.base_dir': '/home/sontek',
        }

        env = get_webassets_env_from_settings(settings, prefix='foo')

        assert env != None
        assert env.directory == settings['foo.base_dir']
        assert env.url == settings['foo.base_url']
开发者ID:0x1997,项目名称:pyramid_webassets,代码行数:13,代码来源:test_webassets.py

示例14: test_get_webassets_env_from_settings_dir_with_colon

    def test_get_webassets_env_from_settings_dir_with_colon(self):
        import pyramid_webassets
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': 'static',
            'webassets.base_dir': 'here:static',
        }

        env = get_webassets_env_from_settings(settings)
        expected = os.path.abspath('here:static')

        assert env.directory == expected
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:13,代码来源:test_webassets.py

示例15: test_webassets_static_view_setting

    def test_webassets_static_view_setting(self):
        from pyramid_webassets import get_webassets_env_from_settings

        settings = {
            'webassets.base_url': 'static',
            'webassets.base_dir': os.getcwd(),
            'webassets.static_view': True,
        }

        env = get_webassets_env_from_settings(settings)

        assert env is not None
        assert env.config['static_view'] == settings['webassets.static_view']
开发者ID:dusual,项目名称:pyramid_webassets,代码行数:13,代码来源:test_webassets.py


注:本文中的pyramid_webassets.get_webassets_env_from_settings函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。