本文整理汇总了Python中core.osutils.file.File.unzip方法的典型用法代码示例。如果您正苦于以下问题:Python File.unzip方法的具体用法?Python File.unzip怎么用?Python File.unzip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.osutils.file.File
的用法示例。
在下文中一共展示了File.unzip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_205_build_android_app_bundle_env_snapshot
# 需要导入模块: from core.osutils.file import File [as 别名]
# 或者: from core.osutils.file.File import unzip [as 别名]
def test_205_build_android_app_bundle_env_snapshot(self):
"""Build app with android app bundle option with --bundle and optimisations for snapshot.
Verify the output(app.aab) and use bundletool to deploy on device."""
# This test will not run on windows because env.snapshot option is not available on that OS
path_to_aab = os.path.join(self.app_name, "platforms", "android", "app", "build", "outputs", "bundle", "release", "app.aab")
#Configure app with snapshot optimisations
source = os.path.join('data', 'abdoid-app-bundle', 'app.gradle')
target = os.path.join(self.app_name, 'app', 'App_Resources', 'Android', 'app.gradle' )
File.copy(src=source, dest=target)
source = os.path.join('data', 'abdoid-app-bundle', 'webpack.config.js')
target = os.path.join(self.app_name, 'webpack.config.js' )
File.copy(src=source, dest=target)
#env.snapshot is applicable only in release build
output = Tns.build_android(attributes={"--path": self.app_name,
"--keyStorePath": ANDROID_KEYSTORE_PATH,
"--keyStorePassword": ANDROID_KEYSTORE_PASS,
"--keyStoreAlias": ANDROID_KEYSTORE_ALIAS,
"--keyStoreAliasPassword": ANDROID_KEYSTORE_ALIAS_PASS,
"--release": "",
"--aab": "",
"--env.uglify": "",
"--env.snapshot": "",
"--bundle": ""
}, assert_success=False)
assert "The build result is located at:" in output
assert path_to_aab in output
assert File.exists(path_to_aab)
#Verify app can be deployed on emulator via bundletool
# Use bundletool to create the .apks file
self.bundletool_build(self.bundletool_path, path_to_aab, self.path_to_apks)
assert File.exists(self.path_to_apks)
# Verify that the correct .so file is included in the package
File.unzip(self.path_to_apks, os.path.join(self.app_name, 'apks'))
File.unzip(os.path.join(self.app_name, 'apks', 'splits', 'base-x86.apk'), os.path.join(self.app_name,'base_apk'))
assert File.exists(os.path.join(self.app_name, 'base_apk', 'lib', 'x86', 'libNativeScript.so'))
# Deploy on device
self.bundletool_deploy(self.bundletool_path, self.path_to_apks, device_id=EMULATOR_ID)
# Start the app on device
Adb.start_app(EMULATOR_ID, "org.nativescript.TestApp")
# Verify app looks correct inside emulator
app_started = Device.wait_for_text(device_id=EMULATOR_ID, text='TAP')
assert app_started, 'App is not started on device'