diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-08-16 08:36:46 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-16 08:36:46 (GMT) |
| commit | cf6d14b96656baa911fa7a793ffa085e1ce6f328 (patch) | |
| tree | 59c7413ac079a5323eed683cac6e321081c27930 /Android/testbed/app/src/androidTest/java | |
| parent | 0dd89a7f4054bb68e7c201c20f939ba03732bde9 (diff) | |
| download | cpython-cf6d14b96656baa911fa7a793ffa085e1ce6f328.zip cpython-cf6d14b96656baa911fa7a793ffa085e1ce6f328.tar.gz cpython-cf6d14b96656baa911fa7a793ffa085e1ce6f328.tar.bz2 | |
[3.13] gh-116622: Add Android test script (GH-121595) (#123061)
gh-116622: Add Android test script (GH-121595)
Adds a script for running the test suite on Android emulator devices. Starting
with a fresh install of the Android Commandline tools; the script manages
installing other requirements, starting the emulator (if required), and
retrieving results from that emulator.
(cherry picked from commit f84cce6f2588c6437d69a30856d7c4ba00b70ae0)
Co-authored-by: Malcolm Smith <smith@chaquo.com>
Diffstat (limited to 'Android/testbed/app/src/androidTest/java')
| -rw-r--r-- | Android/testbed/app/src/androidTest/java/org/python/testbed/PythonSuite.kt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Android/testbed/app/src/androidTest/java/org/python/testbed/PythonSuite.kt b/Android/testbed/app/src/androidTest/java/org/python/testbed/PythonSuite.kt new file mode 100644 index 0000000..0e888ab --- /dev/null +++ b/Android/testbed/app/src/androidTest/java/org/python/testbed/PythonSuite.kt @@ -0,0 +1,35 @@ +package org.python.testbed + +import androidx.test.annotation.UiThreadTest +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + + +@RunWith(AndroidJUnit4::class) +class PythonSuite { + @Test + @UiThreadTest + fun testPython() { + val start = System.currentTimeMillis() + try { + val context = + InstrumentationRegistry.getInstrumentation().targetContext + val args = + InstrumentationRegistry.getArguments().getString("pythonArgs", "") + val status = PythonTestRunner(context).run(args) + assertEquals(0, status) + } finally { + // Make sure the process lives long enough for the test script to + // detect it (see `find_pid` in android.py). + val delay = 2000 - (System.currentTimeMillis() - start) + if (delay > 0) { + Thread.sleep(delay) + } + } + } +} |
