xref: /aosp_15_r20/external/autotest/client/site_tests/infra_PythonVersion/infra_PythonVersion.py (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1# Copyright (c) 2021 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import sys
6
7from autotest_lib.client.bin import test
8from autotest_lib.client.common_lib import error
9
10
11class infra_PythonVersion(test.test):
12    """Test to be run locally for checking Python version in Autotest."""
13    version = 1
14
15    def run_once(self, case):
16        """Verify the running Python Version is as expected."""
17        if sys.version_info.major != case:
18            raise error.TestFail("Not running in python version %s" % case)
19        return
20