diff --git a/googletest/test/gtest_env_var_test.py b/googletest/test/gtest_env_var_test.py index 650b546a..424075cf 100755 --- a/googletest/test/gtest_env_var_test.py +++ b/googletest/test/gtest_env_var_test.py @@ -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.""" - 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')) + SetEnvVar('GTEST_OUTPUT', None) + SetEnvVar('XML_OUTPUT_FILE', 'tmp/bar.xml') + AssertEq('xml:tmp/bar.xml', GetFlag('output')) - # $XML_OUTPUT_FILE without $GTEST_OUTPUT sets output flag - SetEnvVar('GTEST_OUTPUT', None) - AssertEq('xml:tmp/bar.xml', GetFlag('output')) + def testXmlOutputFileOverride(self): + """Tests that $XML_OUTPUT_FILE is overridden by $GTEST_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) + SetEnvVar('GTEST_OUTPUT', 'xml:tmp/foo.xml') + SetEnvVar('XML_OUTPUT_FILE', 'tmp/bar.xml') + AssertEq('xml:tmp/foo.xml', GetFlag('output')) if __name__ == '__main__': gtest_test_utils.Main()