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


Python Folder.is_empty方法代码示例

本文整理汇总了Python中core.osutils.folder.Folder.is_empty方法的典型用法代码示例。如果您正苦于以下问题:Python Folder.is_empty方法的具体用法?Python Folder.is_empty怎么用?Python Folder.is_empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core.osutils.folder.Folder的用法示例。


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

示例1: created_ts

# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import is_empty [as 别名]
    def created_ts(app_name, output=None):
        """
        Assert TypeScript application is created properly.
        :param app_name: App name
        :param output: Output of `tns create command`
        """

        # First make sure base app is created
        TnsAsserts.created(app_name=app_name, output=output)

        # Assert output contains TypeScript plugin
        if USE_YARN != "True":
            if Npm.version() < 5:
                assert 'nativescript-dev-typescript' in output

        # Assert files added with TypeScript plugin
        ts_config = os.path.join(app_name, 'tsconfig.json')
        ref_dts = os.path.join(app_name, 'references.d.ts')
        dts = os.path.join(app_name, TnsAsserts.TNS_MODULES, 'tns-core-modules.d.ts')

        # Assert content of files added with TypeScript plugin.
        assert File.exists(ts_config)
        assert not File.exists(ref_dts)
        assert File.exists(dts)

        ts_config_json = TnsAsserts.get_tsconfig_json(app_name=app_name)
        paths = ts_config_json.get('compilerOptions').get('paths')
        assert paths is not None, 'Paths missing in tsconfig.json'

        assert not Folder.is_empty(os.path.join(app_name, TnsAsserts.NODE_MODULES, 'nativescript-dev-typescript'))
        assert File.exists(os.path.join(app_name, TnsAsserts.HOOKS, 'before-prepare', 'nativescript-dev-typescript.js'))
        assert File.exists(os.path.join(app_name, TnsAsserts.HOOKS, 'before-watch', 'nativescript-dev-typescript.js'))
        assert File.exists(os.path.join(app_name, TnsAsserts.NODE_MODULES, 'typescript', 'bin', 'tsc'))
开发者ID:NativeScript,项目名称:nativescript-cli-tests,代码行数:35,代码来源:tns_verifications.py

示例2: plugin_create

# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import is_empty [as 别名]
    def plugin_create(name, attributes={}, log_trace=False, assert_success=True, tns_path=None, force_clean=True):
        # Detect folder where plugin should be created
        path = attributes.get("--path")
        # noinspection PyUnusedLocal
        folder = path
        if path is None:
            path = name
            folder = name
        else:
            folder = path + os.sep + name

        # Clean target location
        if force_clean:
            Folder.cleanup(folder=path)

        # Execute plugin create command
        output = Tns.run_tns_command("plugin create --includeTypeScriptDemo=y " + name, attributes=attributes, log_trace=log_trace,
                                     tns_path=tns_path)

        if assert_success:
            # Verify command output
            assert "Will now rename some files" in output, "Post clone script not executed."
            assert "Screenshots removed" in output, "Post clone script not executed."
            assert "Solution for {0}".format(name) + " was successfully created" in output, 'Missing message in output.'
            assert "https://docs.nativescript.org/plugins/building-plugins" in output, 'Link to docs is missing.'

            # Verify created files and folders
            plugin_root = os.path.join(TEST_RUN_HOME, folder)
            readme = os.path.join(plugin_root, "README.md")
            src = os.path.join(plugin_root, "src")
            demo = os.path.join(plugin_root, "demo")
            post_clone_script = os.path.join(src, "scripts", "postclone.js")
            assert File.exists(readme), 'README.md do not exists.'
            assert not Folder.is_empty(src), 'src folder should exists and should not be empty.'
            assert not Folder.is_empty(demo), 'demo folder should exists and should not be empty.'
            assert not File.exists(post_clone_script), 'Post clone script should not exists in plugin src folder.'
        return output
开发者ID:NativeScript,项目名称:nativescript-cli-tests,代码行数:39,代码来源:tns.py

示例3: test_330_platform_update_ios_platform_not_added

# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import is_empty [as 别名]
 def test_330_platform_update_ios_platform_not_added(self):
     Tns.create_app(self.app_name)
     output = Tns.platform_update(platform="ios", attributes={"--path": self.app_name}, assert_success=False)
     assert "Platform ios successfully added" in output
     assert not Folder.is_empty(self.app_name + "/platforms/ios/internal/metadata-generator")
开发者ID:NativeScript,项目名称:nativescript-cli-tests,代码行数:7,代码来源:platform_ios_tests.py

示例4: test_201_platform_remove_ios

# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import is_empty [as 别名]
 def test_201_platform_remove_ios(self):
     Tns.platform_add_ios(attributes={"--path": self.app_name, "--frameworkPath": IOS_PACKAGE})
     Tns.platform_remove(platform="ios", attributes={"--path": self.app_name})
     assert Folder.is_empty(self.app_name + '/platforms')
     output = File.read(self.app_name + os.sep + "package.json")
     assert "tns-ios" not in output
开发者ID:NativeScript,项目名称:nativescript-cli-tests,代码行数:8,代码来源:platform_ios_tests.py


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