blob: 6b8a263015a803f2f5a5b7eb436332c07cb132cf [file] [log] [blame]
Dan Willemsen7fa76462020-02-19 19:40:38 -08001# Copyright 2018 Google Inc. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import os
16import sys
17
18# This file checks the visible python state against expected values when run
19# via the py*-cmd prebuilts
20
21failed = False
22def assert_equal(what, a, b):
23 global failed
24 if a != b:
25 print("Expected %s('%s') == '%s'" % (what, a, b))
26 failed = True
27
28assert_equal("__name__", __name__, "testpkg.pycmd_test")
29assert_equal("basename(__file__)", os.path.basename(__file__), "pycmd_test.py")
30assert_equal("__package__", __package__, "testpkg")
31
32if failed:
33 sys.exit(1)