1*28f6c2f2SEnji Cooper#!/usr/bin/env python 2*28f6c2f2SEnji Cooper# 3*28f6c2f2SEnji Cooper# Copyright 2019, Google Inc. 4*28f6c2f2SEnji Cooper# All rights reserved. 5*28f6c2f2SEnji Cooper# 6*28f6c2f2SEnji Cooper# Redistribution and use in source and binary forms, with or without 7*28f6c2f2SEnji Cooper# modification, are permitted provided that the following conditions are 8*28f6c2f2SEnji Cooper# met: 9*28f6c2f2SEnji Cooper# 10*28f6c2f2SEnji Cooper# * Redistributions of source code must retain the above copyright 11*28f6c2f2SEnji Cooper# notice, this list of conditions and the following disclaimer. 12*28f6c2f2SEnji Cooper# * Redistributions in binary form must reproduce the above 13*28f6c2f2SEnji Cooper# copyright notice, this list of conditions and the following disclaimer 14*28f6c2f2SEnji Cooper# in the documentation and/or other materials provided with the 15*28f6c2f2SEnji Cooper# distribution. 16*28f6c2f2SEnji Cooper# * Neither the name of Google Inc. nor the names of its 17*28f6c2f2SEnji Cooper# contributors may be used to endorse or promote products derived from 18*28f6c2f2SEnji Cooper# this software without specific prior written permission. 19*28f6c2f2SEnji Cooper# 20*28f6c2f2SEnji Cooper# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21*28f6c2f2SEnji Cooper# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22*28f6c2f2SEnji Cooper# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23*28f6c2f2SEnji Cooper# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24*28f6c2f2SEnji Cooper# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25*28f6c2f2SEnji Cooper# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26*28f6c2f2SEnji Cooper# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27*28f6c2f2SEnji Cooper# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28*28f6c2f2SEnji Cooper# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29*28f6c2f2SEnji Cooper# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30*28f6c2f2SEnji Cooper# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31*28f6c2f2SEnji Cooper 32*28f6c2f2SEnji Cooper"""Verifies that SetUpTestSuite and TearDownTestSuite errors are noticed.""" 33*28f6c2f2SEnji Cooper 34*28f6c2f2SEnji Cooperfrom googletest.test import gtest_test_utils 35*28f6c2f2SEnji Cooper 36*28f6c2f2SEnji CooperCOMMAND = gtest_test_utils.GetTestExecutablePath( 37*28f6c2f2SEnji Cooper 'googletest-setuptestsuite-test_' 38*28f6c2f2SEnji Cooper) 39*28f6c2f2SEnji Cooper 40*28f6c2f2SEnji Cooper 41*28f6c2f2SEnji Cooperclass GTestSetUpTestSuiteTest(gtest_test_utils.TestCase): 42*28f6c2f2SEnji Cooper 43*28f6c2f2SEnji Cooper def testSetupErrorAndTearDownError(self): 44*28f6c2f2SEnji Cooper p = gtest_test_utils.Subprocess(COMMAND) 45*28f6c2f2SEnji Cooper self.assertNotEqual(p.exit_code, 0, msg=p.output) 46*28f6c2f2SEnji Cooper 47*28f6c2f2SEnji Cooper self.assertIn( 48*28f6c2f2SEnji Cooper ( 49*28f6c2f2SEnji Cooper '[ FAILED ] SetupFailTest: SetUpTestSuite or TearDownTestSuite\n[' 50*28f6c2f2SEnji Cooper ' FAILED ] TearDownFailTest: SetUpTestSuite or' 51*28f6c2f2SEnji Cooper ' TearDownTestSuite\n\n 2 FAILED TEST SUITES\n' 52*28f6c2f2SEnji Cooper ), 53*28f6c2f2SEnji Cooper p.output, 54*28f6c2f2SEnji Cooper ) 55*28f6c2f2SEnji Cooper 56*28f6c2f2SEnji Cooper 57*28f6c2f2SEnji Cooperif __name__ == '__main__': 58*28f6c2f2SEnji Cooper gtest_test_utils.Main() 59