xbuddy: prioritize test images over dev images
Prioritize test images over dev images when the image type is not
given.
BUG=chromium:353040
TEST=None
Change-Id: I303ce652f1717f32a2ba41b5f63d26f40abcdeb0
Reviewed-on: https://chromium-review.googlesource.com/190346
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Yu-Ju Hong <yjhong@chromium.org>
Tested-by: Yu-Ju Hong <yjhong@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
diff --git a/xbuddy.py b/xbuddy.py
index cb8fdbc..c1bc8c9 100644
--- a/xbuddy.py
+++ b/xbuddy.py
@@ -442,14 +442,15 @@
@staticmethod
def _FindAny(local_dir):
"""Returns the image_type for ANY given the local_dir."""
- dev_image = os.path.join(local_dir, devserver_constants.IMAGE_FILE)
test_image = os.path.join(local_dir, devserver_constants.TEST_IMAGE_FILE)
- if os.path.exists(dev_image):
- return 'dev'
-
+ dev_image = os.path.join(local_dir, devserver_constants.IMAGE_FILE)
+ # Prioritize test images over dev images.
if os.path.exists(test_image):
return 'test'
+ if os.path.exists(dev_image):
+ return 'dev'
+
raise XBuddyException('No images found in %s' % local_dir)
@staticmethod