File: python_version_test.py

package info (click to toggle)
protobuf 3.25.4-4
  • links: PTS
  • area: main
  • in suites: experimental
  • size: 45,992 kB
  • sloc: cpp: 204,199; java: 87,622; ansic: 81,204; objc: 58,434; cs: 27,303; python: 22,799; php: 11,340; ruby: 8,637; pascal: 3,324; xml: 2,333; sh: 1,331; makefile: 538; lisp: 86; awk: 17
file content (29 lines) | stat: -rw-r--r-- 844 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc.  All rights reserved.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""Test that Kokoro is using the expected version of python."""

import os
import sys
import unittest


class PythonVersionTest(unittest.TestCase):

  def testPython3(self):
    """Test that we can import nested import public messages."""

    exp = os.getenv('KOKORO_PYTHON_VERSION', '')
    if not exp:
      print('No kokoro python version found, skipping check', file=sys.stderr)
      return
    self.assertTrue(
        sys.version.startswith(exp),
        'Expected Python %s but found Python %s' % (exp, sys.version))


if __name__ == '__main__':
  unittest.main()