本文整理汇总了Python中core.osutils.file.File.pattern_exists方法的典型用法代码示例。如果您正苦于以下问题:Python File.pattern_exists方法的具体用法?Python File.pattern_exists怎么用?Python File.pattern_exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.osutils.file.File
的用法示例。
在下文中一共展示了File.pattern_exists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_001_build_android
# 需要导入模块: from core.osutils.file import File [as 别名]
# 或者: from core.osutils.file.File import pattern_exists [as 别名]
def test_001_build_android(self):
Tns.build_android(attributes={"--path": self.app_name})
assert File.pattern_exists(self.platforms_android, "*.aar")
assert not File.pattern_exists(self.platforms_android, "*.plist")
assert not File.pattern_exists(self.platforms_android, "*.android.js")
assert not File.pattern_exists(self.platforms_android, "*.ios.js")
# Configs are respected
assert 'debug' in File.read(os.path.join(self.app_name, TnsAsserts.PLATFORM_ANDROID_APP_PATH, 'config.json'))
# And new platform specific file and verify next build is ok (test for issue #2697)
src = os.path.join(self.app_name, 'app', 'app.js')
dest_1 = os.path.join(self.app_name, 'app', 'new.android.js')
dest_2 = os.path.join(self.app_name, 'app', 'new.ios.js')
File.copy(src=src, dest=dest_1)
File.copy(src=src, dest=dest_2)
# Verify incremental native build
before_build = datetime.datetime.now()
output = Tns.build_android(attributes={"--path": self.app_name})
after_build = datetime.datetime.now()
assert "Gradle build..." in output, "Gradle build not called."
assert output.count("Gradle build...") is 1, "Only one gradle build is triggered."
assert (after_build - before_build).total_seconds() < 20, "Incremental build takes more then 20 sec."
# Verify platform specific files
assert File.pattern_exists(self.platforms_android, "*.aar")
assert not File.pattern_exists(self.platforms_android, "*.plist")
assert not File.pattern_exists(self.platforms_android, "*.android.js")
assert not File.pattern_exists(self.platforms_android, "*.ios.js")
# Verify apk does not contain aar files
archive = ZipFile(os.path.join(self.app_name, TnsAsserts.PLATFORM_ANDROID_APK_DEBUG_PATH, self.debug_apk))
archive.extractall(self.app_name + "/temp")
archive.close()
# Ceanup META-INF folder. It contains com.android.support.... files which are expected to be there due to
# https://github.com/NativeScript/nativescript-cli/pull/3923
Folder.cleanup(os.path.join(self.app_name, "temp", "META-INF"))
assert not File.pattern_exists(self.app_name + "/temp", "*.aar")
assert not File.pattern_exists(self.app_name + "/temp", "*.plist")
assert not File.pattern_exists(self.app_name + "/temp", "*.android.*")
assert not File.pattern_exists(self.app_name + "/temp", "*.ios.*")
Folder.cleanup(self.app_name + "/temp")
# Verify incremental native build
before_build = datetime.datetime.now()
output = Tns.build_android(attributes={"--path": self.app_name})
after_build = datetime.datetime.now()
assert "Gradle build..." in output, "Gradle build not called."
assert output.count("Gradle build...") is 1, "Only one gradle build is triggered."
assert (after_build - before_build).total_seconds() < 20, "Incremental build takes more then 20 sec."
# Verify clean build force native project rebuild
before_build = datetime.datetime.now()
output = Tns.build_android(attributes={"--path": self.app_name, "--clean": ""})
after_build = datetime.datetime.now()
build_time = (after_build - before_build).total_seconds()
assert "Gradle clean..." in output, "Gradle clean is not called."
assert "Gradle build..." in output, "Gradle build is not called."
assert output.count("Gradle build...") is 1, "More than 1 gradle build is triggered."
assert build_time > 10, "Clean build takes less then 15 sec."
assert build_time < 90, "Clean build takes more than 90 sec."