try/except the import of Tkinter for mac support.
Bug: 113557161
Test: m acloud && acloud on mac
m acloud && acloud on glinux as well to make sure nothing broke (and also scales)
atest acloud_test (make sure you update ~/.bash_profile PATH=/opt/local/bin:$PATH)
Change-Id: I6ce16708483c176e5bac0bb471f7466ad2eb92c2
diff --git a/internal/lib/utils_test.py b/internal/lib/utils_test.py
index 71e2d69..d89cd03 100644
--- a/internal/lib/utils_test.py
+++ b/internal/lib/utils_test.py
@@ -23,7 +23,6 @@
import subprocess
import tempfile
import time
-import Tkinter
import unittest
import mock
@@ -31,6 +30,12 @@
from acloud.internal.lib import driver_test_lib
from acloud.internal.lib import utils
+# Tkinter may not be supported so mock it out.
+try:
+ import Tkinter
+except ImportError:
+ Tkinter = mock.Mock()
+
class FakeTkinter(object):
"""Fake implementation of Tkinter.Tk()"""
@@ -263,6 +268,7 @@
enable_choose_all=True),
answer_list)
+ @unittest.skipIf(isinstance(Tkinter, mock.Mock), "Tkinter mocked out, test case not needed.")
@mock.patch.object(Tkinter, "Tk")
def testCalculateVNCScreenRatio(self, mock_tk):
"""Test Calculating the scale ratio of VNC display."""