本文整理汇总了Python中core.osutils.folder.Folder.exists方法的典型用法代码示例。如果您正苦于以下问题:Python Folder.exists方法的具体用法?Python Folder.exists怎么用?Python Folder.exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.osutils.folder.Folder
的用法示例。
在下文中一共展示了Folder.exists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_android
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import exists [as 别名]
def build_android(attributes={}, assert_success=True, tns_path=None, log_trace=False, measureTime=False):
output = Tns.run_tns_command("build android", attributes=attributes, tns_path=tns_path, log_trace=log_trace,
measureTime=measureTime)
if assert_success:
# Verify output of build command
assert "Project successfully built" in output, "Build failed!" + os.linesep + output
assert "FAILURE" not in output
assert "NOT FOUND" not in output # Test for https://github.com/NativeScript/android-runtime/issues/390
if log_trace:
assert "BUILD SUCCESSFUL" in output, "Build failed!" + os.linesep + output
else:
assert "BUILD SUCCESSFUL" not in output, "Native build out is displayed even without --log trace"
# Verify apk packages
app_name = Tns.__get_app_name_from_attributes(attributes=attributes)
Tns.__get_platform_string(platform=Platform.ANDROID)
android_version_string = str(TnsAsserts.get_platform_version(app_name=app_name, platform='android'))
android_major_version = int(android_version_string.split('-')[0].split('.')[0])
if android_major_version > 3:
apk_name = "app"
debug_app_path = os.path.join(app_name, TnsAsserts.PLATFORM_ANDROID_APK_DEBUG_PATH, apk_name)
release_app_path = os.path.join(app_name, TnsAsserts.PLATFORM_ANDROID_APK_RELEASE_PATH, apk_name)
else:
apk_name = Tns.__get_final_package_name(app_name, platform=Platform.ANDROID)
debug_app_path = os.path.join(app_name, TnsAsserts.PLATFORM_ANDROID_APK_PATH, apk_name)
release_app_path = os.path.join(app_name, TnsAsserts.PLATFORM_ANDROID_APK_PATH, apk_name)
if "--release" in attributes.keys():
apk_path = release_app_path + "-release.apk"
else:
apk_path = debug_app_path + "-debug.apk"
apk_path = apk_path.replace("\"", "") # Handle projects with space
assert File.exists(apk_path), "Apk file does not exist at " + apk_path
# Verify final package contains right modules (or verify bundle when it is used)
if "--bundle" not in attributes.keys():
assert "Webpack compilation complete" not in output
else:
assert "Webpack compilation complete" in output
assert File.exists(os.path.join(app_name, TnsAsserts.PLATFORM_ANDROID_APP_PATH, "bundle.js"))
assert File.exists(os.path.join(app_name, TnsAsserts.PLATFORM_ANDROID_APP_PATH, "package.json"))
assert File.exists(os.path.join(app_name, TnsAsserts.PLATFORM_ANDROID_APP_PATH, "starter.js"))
assert File.exists(os.path.join(app_name, TnsAsserts.PLATFORM_ANDROID_APP_PATH, "vendor.js"))
assert not Folder.exists(os.path.join(app_name, TnsAsserts.PLATFORM_ANDROID_NPM_MODULES_PATH))
return output
示例2: test_400_plugin_create_with_wrong_template
# 需要导入模块: from core.osutils.folder import Folder [as 别名]
# 或者: from core.osutils.folder.Folder import exists [as 别名]
def test_400_plugin_create_with_wrong_template(self):
plugin_url = "https://github.com/NativeScript/nativescript-plugin-seed/"
output = Tns.plugin_create(name=self.plugin_name, attributes={"--template": plugin_url}, assert_success=False)
assert "successfully created" not in output, "It is expected plugin create to fail in this test case."
assert not Folder.exists(self.plugin_name), "Plugin folder should not exists if create operation fails."