當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。