本文整理汇总了Python中pants.backend.android.distribution.android_distribution.AndroidDistribution类的典型用法代码示例。如果您正苦于以下问题:Python AndroidDistribution类的具体用法?Python AndroidDistribution怎么用?Python AndroidDistribution使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AndroidDistribution类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_caching_multiple_sdks
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)
开发者ID:jduan,项目名称:pants,代码行数:7,代码来源:test_android_distribution.py
示例2: test_get_bad_tool_path
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))
开发者ID:pcurry,项目名称:pants,代码行数:7,代码来源:test_android_distribution.py
示例3: test_register_tool_returns_file
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)
开发者ID:jduan,项目名称:pants,代码行数:7,代码来源:test_android_distribution.py
示例4: test_register_copy_is_validated
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)
开发者ID:jduan,项目名称:pants,代码行数:7,代码来源:test_android_distribution.py
示例5: test_register_copy_but_no_tool
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)
开发者ID:jduan,项目名称:pants,代码行数:7,代码来源:test_android_distribution.py
示例6: test_register_tool_no_permission
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)
开发者ID:pcurry,项目名称:pants,代码行数:8,代码来源:test_android_distribution.py
示例7: test_locate_sdk_path
def test_locate_sdk_path(self, path=None):
# We can set good/bad paths alike. No checks until tools are called.
@contextmanager
def env(**kwargs):
environment = dict(ANDROID_HOME=None, ANDROID_SDK_HOME=None, ANDROID_SDK=None)
environment.update(**kwargs)
with environment_as(**environment):
yield
with self.distribution() as sdk:
with env(ANDROooooD_HOME=sdk):
AndroidDistribution.locate_sdk_path(path)
with self.distribution() as sdk:
with env(ANDROID_HOME=sdk):
AndroidDistribution.locate_sdk_path(path)
开发者ID:arloherrine,项目名称:pants,代码行数:17,代码来源:test_android_distribution.py
示例8: test_sdk_path_is_none
def test_sdk_path_is_none(self):
with self.env() as sdk:
with self.assertRaises(AndroidDistribution.DistributionError):
AndroidDistribution.cached(sdk)
开发者ID:jduan,项目名称:pants,代码行数:4,代码来源:test_android_distribution.py
示例9: android_sdk
def android_sdk(self):
"""Instantiate an Android SDK distribution that provides tools to android tasks."""
return AndroidDistribution.cached(self._sdk_path)
开发者ID:MathewJennings,项目名称:pants,代码行数:3,代码来源:android_task.py
示例10: test_register_android_tool_bad_sdk
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)
开发者ID:dominichamon,项目名称:pants,代码行数:6,代码来源:test_android_distribution.py
示例11: test_validated_tools
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)
开发者ID:jduan,项目名称:pants,代码行数:6,代码来源:test_android_distribution.py
示例12: test_register_nonexistent_android_tool
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'))
开发者ID:dominichamon,项目名称:pants,代码行数:5,代码来源:test_android_distribution.py
示例13: test_empty_sdk_path
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)
开发者ID:jduan,项目名称:pants,代码行数:5,代码来源:test_android_distribution.py
示例14: test_validated_tools
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)
开发者ID:dominichamon,项目名称:pants,代码行数:6,代码来源:test_android_distribution.py
示例15: test_locate_sdk_path
def test_locate_sdk_path(self):
with distribution() as sdk:
with self.env(ANDROID_HOME=sdk):
dist = AndroidDistribution.locate_sdk_path()
self.assertEquals(dist._sdk_path, sdk)
开发者ID:jduan,项目名称:pants,代码行数:5,代码来源:test_android_distribution.py
示例16: test_passing_sdk_path
def test_passing_sdk_path(self):
with distribution() as sdk:
android_sdk = AndroidDistribution(sdk_path=sdk)
aapt = os.path.join(sdk, "build-tools", "19.1.0", "aapt")
android_tool = android_sdk.register_android_tool(aapt)
self.assertEquals(android_tool, os.path.join(sdk, aapt))
开发者ID:jduan,项目名称:pants,代码行数:6,代码来源:test_android_distribution.py
示例17: test_locate_no_sdk_on_path
def test_locate_no_sdk_on_path(self):
with self.assertRaises(AndroidDistribution.DistributionError):
with self.distribution() as sdk:
with self.env(ANDROooooD_HOME=sdk):
dist = AndroidDistribution.locate_sdk_path()
self.assertEquals(dist._sdk_path, None)
开发者ID:dominichamon,项目名称:pants,代码行数:6,代码来源:test_android_distribution.py
示例18: test_locate_no_sdk_on_path
def test_locate_no_sdk_on_path(self):
with distribution() as sdk:
with self.env(ANDROooooD_HOME=sdk):
with self.assertRaises(AndroidDistribution.DistributionError):
AndroidDistribution.locate_sdk_path()
开发者ID:jduan,项目名称:pants,代码行数:5,代码来源:test_android_distribution.py
示例19: test_validate_bad_path
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)
开发者ID:jduan,项目名称:pants,代码行数:5,代码来源:test_android_distribution.py
示例20: test_locate_alternative_variables
def test_locate_alternative_variables(self):
# Test that alternative environmental variables are accepted.
with distribution() as sdk:
with self.env(ANDROID_SDK=sdk):
dist = AndroidDistribution.locate_sdk_path()
self.assertEquals(dist._sdk_path, sdk)
开发者ID:jduan,项目名称:pants,代码行数:6,代码来源:test_android_distribution.py
注:本文中的pants.backend.android.distribution.android_distribution.AndroidDistribution类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论