python / python/cpython

Copy files back from Android testbed emulator to host

未关闭
#149,113 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

OS-android type-feature
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

Feature or enhancement

Proposal:

Currently I am trying to add Android support for aiohttp and I am using cibuildwheel to build an test the wheel. For simplicity I am using the default managed Android emulator.

One missing piece, however, is measuring the code coverage of the tests. It is possible to track coverage using pytest-cov, but I haven’t yet found a way to copy the generated .coverage file from the managed Android emulator back to the host PC for further processing. Using adb pull doesn’t work, since the managed Android emulators shut down automatically after the tests. Of course, I could work with a connected Android emulator where the emulator stays on after the tests, allowing me to copy the necessary data using adb pull, but then I would have to manually start an Android emulator before calling cibuildwheel. I would prefer to avoid this extra effort.

Therefore, I suggest modifying the android.py script and the Android testbed to provide a generic way to copy data from the Android emulator back to the host. Here are a few ideas I have:

On idea is to copy the encode files as base64 and output them via logcat. This would be a simple but probably not very practical approach, especially if the files are large.

A propably better solution would be to use the (pretty bad documented) folders build/outputs/managed_device_android_test_additional_output and build/outputs/connected_android_test_additional_output to copy files from the emulator to the host. See for example here or here.

As far as I can tell, this feature would actually only be relevant for third-party packages built using cibuildwheel, for example. However, since cibuildwheel uses the android.py script and the Android testbed project from CPython, such a feature would need to be added to CPython and cannot be implemented within cibuildwheel itself.

I already have a working draft that uses managed_device_android_test_additional_output, but I wanted to discuss this first to see if it’s a useful addition or if it’s actually out of scope for CPython?

@mhsmith What do you think?

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs
  • gh-149271

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先检查 android.py 脚本和 Android 测试环境,然后查看 managed_device_android_test_additional_output 和 connected_android_test_additional_output 的使用方式。当一个通用机制能够在测试结束后使 managed emulator 上生成的文件在 host 上可用(包括用于进一步处理的 .coverage 文件)时,这项修改就完成了。

由索引模型根据 Issue 内容生成。

评估

技术栈
android, python
领域
mobile, testing
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。