自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
PythonUnitTestRunner
public
class
PythonUnitTestRunner
extends Object
implements
IBuildReceiver,
IRemoteTest
java.lang.Object
|
↳ |
com.android.tradefed.testtype.PythonUnitTestRunner
|
此类已废弃。
请改用 PythonBinaryHostTest
。
运行使用 unittest 库编写的 Python 测试。
摘要
公共构造函数
PythonUnitTestRunner
public PythonUnitTestRunner ()
公共方法
setBuild
public void setBuild (IBuildInfo buildInfo)
受保护的方法
checkPythonVersion
protected void checkPythonVersion (CommandResult c)
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# PythonUnitTestRunner\n====================\n\n\n`\npublic\n\n\nclass\nPythonUnitTestRunner\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\nimplements\n\n`[IBuildReceiver](../../../../../../reference/tradefed/com/android/tradefed/testtype/IBuildReceiver.html)`,\n\n`[IRemoteTest](../../../../../../reference/tradefed/com/android/tradefed/testtype/IRemoteTest.html)`\n\n\n`\n\n|---|----------------------------------------------------|\n| java.lang.Object ||\n| ↳ | com.android.tradefed.testtype.PythonUnitTestRunner |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\n**This class is deprecated.** \n\nUse [PythonBinaryHostTest](../../../../../../reference/tradefed/com/android/tradefed/testtype/python/PythonBinaryHostTest.html) instead.\n\nRuns Python tests written with the unittest library.\n\nSummary\n-------\n\n| ### Public constructors ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[PythonUnitTestRunner](../../../../../../reference/tradefed/com/android/tradefed/testtype/PythonUnitTestRunner.html#PythonUnitTestRunner())`() ` |\n\n| ### Public methods ||\n|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` void` | ` `[run](../../../../../../reference/tradefed/com/android/tradefed/testtype/PythonUnitTestRunner.html#run(com.android.tradefed.invoker.TestInformation,%20com.android.tradefed.result.ITestInvocationListener))`(`[TestInformation](../../../../../../reference/tradefed/com/android/tradefed/invoker/TestInformation.html)` testInfo, `[ITestInvocationListener](../../../../../../reference/tradefed/com/android/tradefed/result/ITestInvocationListener.html)` listener) ` Runs the tests, and reports result to the listener. |\n| ` void` | ` `[setBuild](../../../../../../reference/tradefed/com/android/tradefed/testtype/PythonUnitTestRunner.html#setBuild(com.android.tradefed.build.IBuildInfo))`(`[IBuildInfo](../../../../../../reference/tradefed/com/android/tradefed/build/IBuildInfo.html)` buildInfo) ` |\n\n| ### Protected methods ||\n|--------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` void` | ` `[checkPythonVersion](../../../../../../reference/tradefed/com/android/tradefed/testtype/PythonUnitTestRunner.html#checkPythonVersion(com.android.tradefed.util.CommandResult))`(`[CommandResult](../../../../../../reference/tradefed/com/android/tradefed/util/CommandResult.html)` c) ` |\n| ` `[IBuildInfo](../../../../../../reference/tradefed/com/android/tradefed/build/IBuildInfo.html) | ` `[getBuild](../../../../../../reference/tradefed/com/android/tradefed/testtype/PythonUnitTestRunner.html#getBuild())`() ` Returns the [IBuildInfo](../../../../../../reference/tradefed/com/android/tradefed/build/IBuildInfo.html) for this invocation. |\n| ` `[IRunUtil](../../../../../../reference/tradefed/com/android/tradefed/util/IRunUtil.html) | ` `[getRunUtil](../../../../../../reference/tradefed/com/android/tradefed/testtype/PythonUnitTestRunner.html#getRunUtil())`() ` Returns an [IRunUtil](../../../../../../reference/tradefed/com/android/tradefed/util/IRunUtil.html) that runs the unittest |\n\nPublic constructors\n-------------------\n\n### PythonUnitTestRunner\n\n```\npublic PythonUnitTestRunner ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### run\n\n```\npublic void run (TestInformation testInfo, \n ITestInvocationListener listener)\n```\n\nRuns the tests, and reports result to the listener.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `testInfo` | `TestInformation`: The [TestInformation](../../../../../../reference/tradefed/com/android/tradefed/invoker/TestInformation.html) object containing useful information to run tests. \u003cbr /\u003e |\n| `listener` | `ITestInvocationListener`: the [ITestInvocationListener](../../../../../../reference/tradefed/com/android/tradefed/result/ITestInvocationListener.html) of test results \u003cbr /\u003e |\n\n| Throws ||\n|----------------------------------------------------------------------------------------------------------------------------------|---|\n| [DeviceNotAvailableException](../../../../../../reference/tradefed/com/android/tradefed/device/DeviceNotAvailableException.html) | |\n\n### setBuild\n\n```\npublic void setBuild (IBuildInfo buildInfo)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------------|---------------------|\n| `buildInfo` | `IBuildInfo` \u003cbr /\u003e |\n\nProtected methods\n-----------------\n\n### checkPythonVersion\n\n```\nprotected void checkPythonVersion (CommandResult c)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----|------------------------|\n| `c` | `CommandResult` \u003cbr /\u003e |\n\n### getBuild\n\n```\nprotected IBuildInfo getBuild ()\n```\n\nReturns the [IBuildInfo](../../../../../../reference/tradefed/com/android/tradefed/build/IBuildInfo.html) for this invocation.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-----------------------------------------------------------------------------------------------|--------|\n| [IBuildInfo](../../../../../../reference/tradefed/com/android/tradefed/build/IBuildInfo.html) | \u003cbr /\u003e |\n\n### getRunUtil\n\n```\nprotected IRunUtil getRunUtil ()\n```\n\nReturns an [IRunUtil](../../../../../../reference/tradefed/com/android/tradefed/util/IRunUtil.html) that runs the unittest\n\n\u003cbr /\u003e\n\n| Returns ||\n|------------------------------------------------------------------------------------------|--------|\n| [IRunUtil](../../../../../../reference/tradefed/com/android/tradefed/util/IRunUtil.html) | \u003cbr /\u003e |"]]