aboutsummaryrefslogtreecommitdiff
path: root/binary_search_tool/test
diff options
context:
space:
mode:
authorCassidy Burden <cburden@google.com>2016-06-17 16:29:16 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-06-20 12:00:22 -0700
commit47de616141aac91d6d3e15e80591d1aca8dffc57 (patch)
treef08b4362c4c4bb36aa0b576e275a9e5839907174 /binary_search_tool/test
parentd6d5b5e0a1f3912501f791cbb0b544ae1f114949 (diff)
downloadtoolchain-utils-47de616141aac91d6d3e15e80591d1aca8dffc57.tar.gz
binary search tool: Cleanup state files after SaveState unit test
Running test_bad_save_state would previously leave a save state with no symlink pointing to it. This would cause multiple save states to gather and clutter up the directory. We now simply cleanup the generated save state in this test case. TEST=Run unit test and see if any state files remain Change-Id: If594c7266b2ff24a260e746a4d06bddea2c0bf78 Reviewed-on: https://chrome-internal-review.googlesource.com/265286 Commit-Ready: Cassidy Burden <cburden@google.com> Tested-by: Cassidy Burden <cburden@google.com> Reviewed-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'binary_search_tool/test')
-rwxr-xr-xbinary_search_tool/test/binary_search_tool_tester.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/binary_search_tool/test/binary_search_tool_tester.py b/binary_search_tool/test/binary_search_tool_tester.py
index 47452d03..a5123620 100755
--- a/binary_search_tool/test/binary_search_tool_tester.py
+++ b/binary_search_tool/test/binary_search_tool_tester.py
@@ -81,6 +81,7 @@ class BisectingUtilsTest(unittest.TestCase):
def test_bad_save_state(self):
state_file = binary_search_state.STATE_FILE
+ hidden_state_file = os.path.basename(binary_search_state.HIDDEN_STATE_FILE)
with open(state_file, 'w') as f:
f.write('test123')
@@ -94,6 +95,11 @@ class BisectingUtilsTest(unittest.TestCase):
os.remove(state_file)
+ # Cleanup generated save state that has no symlink
+ files = os.listdir(os.getcwd())
+ save_states = [x for x in files if x.startswith(hidden_state_file)]
+ _ = [os.remove(x) for x in save_states]
+
def test_save_state(self):
state_file = binary_search_state.STATE_FILE