本文整理汇总了Python中pants.backend.android.distribution.android_distribution.AndroidDistribution.cached方法的典型用法代码示例。如果您正苦于以下问题:Python AndroidDistribution.cached方法的具体用法?Python AndroidDistribution.cached怎么用?Python AndroidDistribution.cached使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pants.backend.android.distribution.android_distribution.AndroidDistribution
的用法示例。
在下文中一共展示了AndroidDistribution.cached方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_caching_multiple_sdks
# 需要导入模块: from pants.backend.android.distribution.android_distribution import AndroidDistribution [as 别名]
# 或者: from pants.backend.android.distribution.android_distribution.AndroidDistribution import cached [as 别名]
def test_caching_multiple_sdks(self):
with distribution() as first_sdk_path:
with distribution() as second_sdk_path:
first_sdk_instance = AndroidDistribution.cached(first_sdk_path)
second_sdk_instance = AndroidDistribution.cached(second_sdk_path)
self.assertEquals(AndroidDistribution._CACHED_SDK[first_sdk_path], first_sdk_instance)
self.assertEquals(AndroidDistribution._CACHED_SDK[second_sdk_path], second_sdk_instance)
示例2: test_register_copy_but_no_tool
# 需要导入模块: from pants.backend.android.distribution.android_distribution import AndroidDistribution [as 别名]
# 或者: from pants.backend.android.distribution.android_distribution.AndroidDistribution import cached [as 别名]
def test_register_copy_but_no_tool(self):
with distribution() as sdk:
with temporary_dir() as workdir:
android_sdk = AndroidDistribution.cached(sdk)
android_jar = os.path.join("platforms", "android-19", "no.jar")
with self.assertRaises(AndroidDistribution.DistributionError):
android_sdk.register_android_tool(android_jar, workdir=workdir)
示例3: test_register_copy_is_validated
# 需要导入模块: from pants.backend.android.distribution.android_distribution import AndroidDistribution [as 别名]
# 或者: from pants.backend.android.distribution.android_distribution.AndroidDistribution import cached [as 别名]
def test_register_copy_is_validated(self):
with distribution() as sdk:
with temporary_dir() as workdir:
android_sdk = AndroidDistribution.cached(sdk)
android_jar = os.path.join("platforms", "android-19", "android.jar")
android_sdk.register_android_tool(android_jar, workdir=workdir)
self.assertIn(android_jar, android_sdk._validated_tools)
示例4: test_register_tool_returns_file
# 需要导入模块: from pants.backend.android.distribution.android_distribution import AndroidDistribution [as 别名]
# 或者: from pants.backend.android.distribution.android_distribution.AndroidDistribution import cached [as 别名]
def test_register_tool_returns_file(self):
with distribution() as sdk:
with temporary_dir() as workdir:
android_sdk = AndroidDistribution.cached(sdk)
android_jar = os.path.join("platforms", "android-19", "android.jar")
android_sdk.register_android_tool(android_jar, workdir=workdir)
self.assertEquals(os.path.isfile(android_sdk._validated_tools[android_jar]), True)
示例5: test_get_bad_tool_path
# 需要导入模块: from pants.backend.android.distribution.android_distribution import AndroidDistribution [as 别名]
# 或者: from pants.backend.android.distribution.android_distribution.AndroidDistribution import cached [as 别名]
def test_get_bad_tool_path(self):
with self.assertRaises(AndroidDistribution.DistributionError):
with distribution() as sdk:
android_sdk = AndroidDistribution.cached(sdk)
android_jar = os.path.join("platforms", "android-19", "no.jar")
tool_path = android_sdk._get_tool_path(android_jar)
self.assertEquals(tool_path, os.path.join(sdk, android_jar))
示例6: test_register_tool_no_permission
# 需要导入模块: from pants.backend.android.distribution.android_distribution import AndroidDistribution [as 别名]
# 或者: from pants.backend.android.distribution.android_distribution.AndroidDistribution import cached [as 别名]
def test_register_tool_no_permission(self):
with self.assertRaises(AndroidDistribution.DistributionError):
with distribution() as sdk:
with temporary_dir() as workdir:
os.chmod(workdir, 0o400)
android_sdk = AndroidDistribution.cached(sdk)
android_jar = os.path.join("platforms", "android-19", "android.jar")
android_sdk.register_android_tool(android_jar, workdir=workdir)
示例7: test_validated_tools
# 需要导入模块: from pants.backend.android.distribution.android_distribution import AndroidDistribution [as 别名]
# 或者: from pants.backend.android.distribution.android_distribution.AndroidDistribution import cached [as 别名]
def test_validated_tools(self):
with distribution() as sdk:
android_sdk = AndroidDistribution.cached(sdk)
aapt = os.path.join("build-tools", "19.1.0", "aapt")
android_sdk.register_android_tool(aapt)
self.assertIn(aapt, android_sdk._validated_tools)
示例8: test_register_nonexistent_android_tool
# 需要导入模块: from pants.backend.android.distribution.android_distribution import AndroidDistribution [as 别名]
# 或者: from pants.backend.android.distribution.android_distribution.AndroidDistribution import cached [as 别名]
def test_register_nonexistent_android_tool(self):
with distribution() as sdk:
android_sdk = AndroidDistribution.cached(sdk)
with self.assertRaises(AndroidDistribution.DistributionError):
android_sdk.register_android_tool(os.path.join("build-tools", "19.1.0", "random_tool"))
示例9: test_empty_sdk_path
# 需要导入模块: from pants.backend.android.distribution.android_distribution import AndroidDistribution [as 别名]
# 或者: from pants.backend.android.distribution.android_distribution.AndroidDistribution import cached [as 别名]
def test_empty_sdk_path(self):
# Shows that an AndroidDistribution can be created as long as an sdk path is declared.
with temporary_dir() as sdk:
android_sdk = AndroidDistribution.cached(sdk)
self.assertEquals(android_sdk._sdk_path, sdk)
示例10: test_validate_bad_path
# 需要导入模块: from pants.backend.android.distribution.android_distribution import AndroidDistribution [as 别名]
# 或者: from pants.backend.android.distribution.android_distribution.AndroidDistribution import cached [as 别名]
def test_validate_bad_path(self):
# The SDK path is not validated until the tool is registered.
sdk = os.path.join("/no", "sdk", "here")
android_sdk = AndroidDistribution.cached(sdk)
self.assertEquals(sdk, android_sdk._sdk_path)
示例11: test_sdk_path_is_none
# 需要导入模块: from pants.backend.android.distribution.android_distribution import AndroidDistribution [as 别名]
# 或者: from pants.backend.android.distribution.android_distribution.AndroidDistribution import cached [as 别名]
def test_sdk_path_is_none(self):
with self.env() as sdk:
with self.assertRaises(AndroidDistribution.DistributionError):
AndroidDistribution.cached(sdk)
示例12: test_validated_tools
# 需要导入模块: from pants.backend.android.distribution.android_distribution import AndroidDistribution [as 别名]
# 或者: from pants.backend.android.distribution.android_distribution.AndroidDistribution import cached [as 别名]
def test_validated_tools(self):
with self.distribution() as sdk:
android_sdk = AndroidDistribution.cached(sdk)
aapt = os.path.join('build-tools', '19.1.0', 'aapt')
android_sdk.register_android_tool(aapt)
self.assertIn(aapt, android_sdk._validated_tools)
示例13: test_register_nonexistent_android_tool
# 需要导入模块: from pants.backend.android.distribution.android_distribution import AndroidDistribution [as 别名]
# 或者: from pants.backend.android.distribution.android_distribution.AndroidDistribution import cached [as 别名]
def test_register_nonexistent_android_tool(self):
with self.assertRaises(AndroidDistribution.DistributionError):
with self.distribution() as sdk:
android_sdk = AndroidDistribution.cached(sdk)
android_sdk.register_android_tool(os.path.join('build-tools', '19.1.0', 'random_tool'))
示例14: test_register_android_tool_bad_sdk
# 需要导入模块: from pants.backend.android.distribution.android_distribution import AndroidDistribution [as 别名]
# 或者: from pants.backend.android.distribution.android_distribution.AndroidDistribution import cached [as 别名]
def test_register_android_tool_bad_sdk(self):
with self.assertRaises(AndroidDistribution.DistributionError):
sdk = os.path.join('/no', 'sdk', 'here')
android_sdk = AndroidDistribution.cached(sdk)
aapt = os.path.join('build-tools', '19.1.0', 'aapt')
android_sdk.register_android_tool(aapt)
示例15: android_sdk
# 需要导入模块: from pants.backend.android.distribution.android_distribution import AndroidDistribution [as 别名]
# 或者: from pants.backend.android.distribution.android_distribution.AndroidDistribution import cached [as 别名]
def android_sdk(self):
"""Instantiate an Android SDK distribution that provides tools to android tasks."""
return AndroidDistribution.cached(self._sdk_path)