diff options
author | Doug Greiman <dgreiman@google.com> | 2016-03-02 20:07:42 (GMT) |
---|---|---|
committer | Doug Greiman <dgreiman@google.com> | 2016-03-02 20:07:42 (GMT) |
commit | d23cf2b1570122cdcd7dd5b4edaa614792417763 (patch) | |
tree | 06e5164694ad8dd56a99436a445cbf8a7b6c2977 /googletest | |
parent | 6991f422b65acd1fe9212cfd6ca2153e9757ad5d (diff) | |
download | googletest-d23cf2b1570122cdcd7dd5b4edaa614792417763.zip googletest-d23cf2b1570122cdcd7dd5b4edaa614792417763.tar.gz googletest-d23cf2b1570122cdcd7dd5b4edaa614792417763.tar.bz2 |
Restructure test so each scenario is independent.refs/pull/724/head
Diffstat (limited to 'googletest')
-rwxr-xr-x | googletest/test/gtest_env_var_test.py | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/googletest/test/gtest_env_var_test.py b/googletest/test/gtest_env_var_test.py index 650b546..424075c 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.""" - - 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) + """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""" + + 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() |