android / android-test

An extensive framework for testing Android apps
https://android.github.io/android-test
Apache License 2.0
1.16k stars 314 forks source link

Migrate to Python 3 #609

Open iphydf opened 4 years ago

iphydf commented 4 years ago

10 months ago, daf2db024fc249cc0b14b0553f0673416a877792 added a flag to force Python 2 (PY2), but it's now (3 months ago) officially sunset. With bazel 2.2.0, I can no longer build or run instrumentation tests. I tried to migrate bits to python3 in an ad-hoc hacky way, but it turned out to be a rabbit hole filled with protobufs, so I gave up. The files I did touch were pretty easy to fix (some StringIO -> io, print '' -> print(''), ConfigParser -> configparser, etc.). I gave up when I came across generated _pb2.py files.

Please migrate to python3 and drop support for python2.

xunkai55 commented 3 years ago

Upvote this issue. I'm currently building a test with bazel, whose most dependencies require PY3.

jwhpryor commented 2 years ago

I also recently ran into this when attempting to build an android_instrumentation_test. FWIW I'm not super skilled with handling setting up dependencies for linux environments, however I'm seeing the following when trying to build:

  File "$LONG_PATH_OMITTED/bazel-out/host/bin/external/android_test_support/tools/android/emulator/unified_launcher_head.runfiles/android_test_support/tools/android/emulator/unified_launcher.py", line 468
    print ''

My workspace is currently pinned at fd8531231578414a6024f302376e9b8c489b9cb4 (recent). There were other steps that made it necessary to use python3, but I've had issues at other stages in getting an initial run working so I might have got a bad environment.