blob: f851526a65100a4bcdec5f2b7a60228d2383e0d1 [file] [log] [blame]
Mike Kruskaled5c57a2022-08-10 22:51:29 -07001# Protocol Buffers - Google's data interchange format
2# Copyright 2008 Google Inc. All rights reserved.
Mike Kruskaled5c57a2022-08-10 22:51:29 -07003#
Joshua Habermandb20f5f2023-09-09 08:59:23 -07004# Use of this source code is governed by a BSD-style
5# license that can be found in the LICENSE file or at
6# https://developers.google.com/open-source/licenses/bsd
Mike Kruskaled5c57a2022-08-10 22:51:29 -07007"""Test that Kokoro is using the expected version of python."""
8
9import os
Mike Kruskaled5c57a2022-08-10 22:51:29 -070010import sys
Mike Kruskalca4b0632022-08-11 20:55:01 -070011import unittest
12
Mike Kruskaled5c57a2022-08-10 22:51:29 -070013
14class PythonVersionTest(unittest.TestCase):
15
16 def testPython3(self):
17 """Test that we can import nested import public messages."""
18
19 exp = os.getenv('KOKORO_PYTHON_VERSION', '')
Mike Kruskalca4b0632022-08-11 20:55:01 -070020 if not exp:
21 print('No kokoro python version found, skipping check', file=sys.stderr)
Mike Kruskaled5c57a2022-08-10 22:51:29 -070022 return
Mike Kruskalca4b0632022-08-11 20:55:01 -070023 self.assertTrue(
24 sys.version.startswith(exp),
25 'Expected Python %s but found Python %s' % (exp, sys.version))
Mike Kruskaled5c57a2022-08-10 22:51:29 -070026
27
28if __name__ == '__main__':
29 unittest.main()