Restructure test so each scenario is independent.
This commit is contained in:
parent
6991f422b6
commit
d23cf2b157
@ -84,11 +84,10 @@ class GTestEnvVarTest(gtest_test_utils.TestCase):
|
||||
def testEnvVarAffectsFlag(self):
|
||||
"""Tests that environment variable should affect the corresponding flag."""
|
||||
|
||||
SetEnvVar('XML_OUTPUT_FILE', None)
|
||||
|
||||
TestFlag('break_on_failure', '1', '0')
|
||||
TestFlag('color', 'yes', 'auto')
|
||||
TestFlag('filter', 'FooTest.Bar', '*')
|
||||
SetEnvVar('XML_OUTPUT_FILE', None) # For 'output' test
|
||||
TestFlag('output', 'xml:tmp/foo.xml', '')
|
||||
TestFlag('print_time', '0', '1')
|
||||
TestFlag('repeat', '999', '1')
|
||||
@ -101,24 +100,18 @@ class GTestEnvVarTest(gtest_test_utils.TestCase):
|
||||
TestFlag('stack_trace_depth', '0', '100')
|
||||
|
||||
def testXmlOutputFile(self):
|
||||
"""Test that $XML_OUTPUT_FILE affects the output flag."""
|
||||
"""Tests that $XML_OUTPUT_FILE affects the output flag."""
|
||||
|
||||
SetEnvVar('GTEST_OUTPUT', None)
|
||||
SetEnvVar('XML_OUTPUT_FILE', 'tmp/bar.xml')
|
||||
AssertEq('xml:tmp/bar.xml', GetFlag('output'))
|
||||
|
||||
def testXmlOutputFileOverride(self):
|
||||
"""Tests that $XML_OUTPUT_FILE is overridden by $GTEST_OUTPUT"""
|
||||
|
||||
try:
|
||||
# $XML_OUTPUT_FILE is overridden by $GTEST_OUTPUT
|
||||
SetEnvVar('GTEST_OUTPUT', 'xml:tmp/foo.xml')
|
||||
SetEnvVar('XML_OUTPUT_FILE', 'tmp/bar.xml')
|
||||
AssertEq('xml:tmp/foo.xml', GetFlag('output'))
|
||||
|
||||
# $XML_OUTPUT_FILE without $GTEST_OUTPUT sets output flag
|
||||
SetEnvVar('GTEST_OUTPUT', None)
|
||||
AssertEq('xml:tmp/bar.xml', GetFlag('output'))
|
||||
|
||||
# If neither set, flag has default value
|
||||
SetEnvVar('XML_OUTPUT_FILE', None)
|
||||
AssertEq('', GetFlag('output'))
|
||||
finally:
|
||||
SetEnvVar('GTEST_OUTPUT', None)
|
||||
SetEnvVar('XML_OUTPUT_FILE', None)
|
||||
|
||||
if __name__ == '__main__':
|
||||
gtest_test_utils.Main()
|
||||
|
Loading…
Reference in New Issue
Block a user