当前位置: 首页>>代码示例>>Python>>正文


Python AndroidDistribution.cached方法代码示例

本文整理汇总了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)
开发者ID:jduan,项目名称:pants,代码行数:9,代码来源:test_android_distribution.py

示例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)
开发者ID:jduan,项目名称:pants,代码行数:9,代码来源:test_android_distribution.py

示例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)
开发者ID:jduan,项目名称:pants,代码行数:9,代码来源:test_android_distribution.py

示例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)
开发者ID:jduan,项目名称:pants,代码行数:9,代码来源:test_android_distribution.py

示例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))
开发者ID:pcurry,项目名称:pants,代码行数:9,代码来源:test_android_distribution.py

示例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)
开发者ID:pcurry,项目名称:pants,代码行数:10,代码来源:test_android_distribution.py

示例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)
开发者ID:jduan,项目名称:pants,代码行数:8,代码来源:test_android_distribution.py

示例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"))
开发者ID:jduan,项目名称:pants,代码行数:7,代码来源:test_android_distribution.py

示例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)
开发者ID:jduan,项目名称:pants,代码行数:7,代码来源:test_android_distribution.py

示例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)
开发者ID:jduan,项目名称:pants,代码行数:7,代码来源:test_android_distribution.py

示例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)
开发者ID:jduan,项目名称:pants,代码行数:6,代码来源:test_android_distribution.py

示例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)
开发者ID:dominichamon,项目名称:pants,代码行数:8,代码来源:test_android_distribution.py

示例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'))
开发者ID:dominichamon,项目名称:pants,代码行数:7,代码来源:test_android_distribution.py

示例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)
开发者ID:dominichamon,项目名称:pants,代码行数:8,代码来源:test_android_distribution.py

示例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)
开发者ID:MathewJennings,项目名称:pants,代码行数:5,代码来源:android_task.py


注:本文中的pants.backend.android.distribution.android_distribution.AndroidDistribution.cached方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。