From 876527d6f698293a23752b76e1e4509685e730e0 Mon Sep 17 00:00:00 2001 From: Daniel Toyama Date: Tue, 14 Jul 2026 17:08:31 -0700 Subject: [PATCH] Enable pytype check in GitHub CI. PiperOrigin-RevId: 947987637 --- .github/workflows/tests.yml | 6 ++++++ .../components/simulators/fake/fake_simulator_test.py | 1 + android_env/components/task_manager_test.py | 1 + 3 files changed, 8 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5bb5509f..d7b9927e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -32,6 +32,12 @@ jobs: pip install --upgrade pip setuptools pip install .[testing] + - name: Run pytype + if: matrix.python-version != '3.13' + run: | + rm -f android_env/proto/*_pb2.py android_env/proto/a11y/*_pb2.py android_env/proto/*_pb2_grpc.py + pytype android_env + - name: Run tests run: | # Find all test files, print their names and execute them in parallel diff --git a/android_env/components/simulators/fake/fake_simulator_test.py b/android_env/components/simulators/fake/fake_simulator_test.py index 15d86401..6f2e53e2 100644 --- a/android_env/components/simulators/fake/fake_simulator_test.py +++ b/android_env/components/simulators/fake/fake_simulator_test.py @@ -79,6 +79,7 @@ def test_adb_output(self): line = line.decode('utf-8') matches = re.match(r'\s+SurfaceOrientation:\s+(\d)', line) self.assertIsNotNone(matches) + assert matches is not None orientation = matches.group(1) self.assertEqual(orientation, '0') line = adb_controller.execute_command(['shell', 'service', 'check', 'foo']) diff --git a/android_env/components/task_manager_test.py b/android_env/components/task_manager_test.py index e53e5dd2..5a9b0fb2 100644 --- a/android_env/components/task_manager_test.py +++ b/android_env/components/task_manager_test.py @@ -62,6 +62,7 @@ def _assert_match(self, event: re.Pattern[str], text: str) -> re.Match[str]: self.assertRegex(text, event) match = event.fullmatch(text) self.assertIsNotNone(match) + assert match is not None return match def test_start(self):