18072 Automated GUI tests broken
authorMichal Pryc <Michal.Pryc@Oracle.Com>
Mon, 09 May 2011 19:45:50 +0200
changeset 2340 194a87d123d4
parent 2339 aa5954c06b9d
child 2341 e01b38fd9781
18072 Automated GUI tests broken
src/setup.py
src/tests/gui/t_pm_addrepo.py
src/tests/gui/t_pm_helpabout.py
src/tests/gui/t_pm_install.py
src/tests/gui/t_pm_install_py
src/tests/gui/t_pm_rmrepo.py
src/tests/gui/t_pm_start.py
src/tests/gui/t_pm_uninstall.py
src/tests/run.py
--- a/src/setup.py	Sat May 07 00:25:10 2011 -0700
+++ b/src/setup.py	Mon May 09 19:45:50 2011 +0200
@@ -860,6 +860,7 @@
             ("port=", "z", "lowest port to start a depot on"),
             ("timing", "t", "timing file <file>"),
             ("verbosemode", 'v', "run tests in verbose mode"),
+            ("enableguitests", 'u', "enable IPS GUI tests, disabled by default"),
             ("stoponerr", 'x', "stop when a baseline mismatch occurs"),
             ("debugoutput", 'd', "emit debugging output"),
             ("showonexpectedfail", 'f',
--- a/src/tests/gui/t_pm_addrepo.py	Sat May 07 00:25:10 2011 -0700
+++ b/src/tests/gui/t_pm_addrepo.py	Mon May 09 19:45:50 2011 +0200
@@ -20,7 +20,7 @@
 # CDDL HEADER END
 #
 
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
 
 import testutils
 if __name__ == "__main__":
@@ -30,41 +30,60 @@
 
 try:
         import ldtp
+        import ldtputils
+        if not "getmin" in dir(ldtp):
+            raise ImportError
 except ImportError:
-        raise ImportError, "SUNWldtp package not installed."
+        raise ImportError, "ldtp 2.X package not installed."
 
-class TestPkgGuiAddRepoBasics(pkg5unittest.SingleDepotTestCase):
+class TestPkgGuiAddRepoBasics(pkg5unittest.ManyDepotTestCase):
 
         # pygtk requires unicode as the default encoding.
         default_utf8 = True
 
-        foo10 = """
-            open [email protected],5.11-0
-            add set name="description" value="Some package1 description"
+        foo1 = """
+            open foo@1,5.11-0
+            close """
+
+        bar1 = """
+            open bar@1,5.11-0
             close """
 
+        def setUp(self):
+                pkg5unittest.ManyDepotTestCase.setUp(self, ["test1", "test2"],
+                    start_depots=True)
+
+                durl1 = self.dcs[1].get_depot_url()
+                self.pkgsend_bulk(durl1, self.foo1)
+
+                durl2 = self.dcs[2].get_depot_url()
+                self.pkgsend_bulk(durl2, self.bar1)
+
+                self.image_create(durl1, prefix="test1")
+
         def testAddRepository(self):
-                repo_name = 'testadd'
-                repo_url = self.dc.get_depot_url()
-                self.pkgsend_bulk(repo_url, self.foo10)
-                self.image_create(repo_url)
-
-                ldtp.launchapp("%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area)
+                repo_name = "test2"
+                pm_str = "%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area
+                ldtp.launchapp(pm_str,["-R", self.get_img_path()])
+                ldtp.waittillguiexist('Package Manager', state = ldtp.state.ENABLED)
 
-                ldtp.selectmenuitem('frmPackageManager', 'mnuManageRepositories')
+                ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuAdd Publisher...')
+                
+                ldtp.waittillguiexist('dlgAdd Publisher')
 
-                ldtp.waittillguiexist('dlgManageRepositories')
+                ldtp.settextvalue('dlgAdd Publisher', "txtURI", self.dcs[2].get_depot_url())
 
-                ldtp.settextvalue("dlgManageRepositories", "txtName", repo_name)
-                ldtp.settextvalue("dlgManageRepositories", "txtURL", repo_url)
-                ldtp.click('dlgManageRepositories', 'btnAdd')
+                ldtp.click('dlgAdd Publisher', 'btnAdd')
 
-                ldtp.click('dlgManageRepositories', 'btnClose')
+                ldtp.waittillguiexist('dlgAdding Publisher Complete')
+
+                ldtp.click('dlgAdding Publisher Complete', 'btnClose')
 
                 # Verify result
-                self.pkg('publisher | grep %s' % repo_name)
+                self.pkg('publisher | grep %s' % repo_name, exit=0)
+
                 # Quit Package Manager
-                ldtp.selectmenuitem('frmPackageManager', 'mnuQuit')
+                ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuQuit')
 
 if __name__ == "__main__":
 	unittest.main()
--- a/src/tests/gui/t_pm_helpabout.py	Sat May 07 00:25:10 2011 -0700
+++ b/src/tests/gui/t_pm_helpabout.py	Mon May 09 19:45:50 2011 +0200
@@ -20,7 +20,7 @@
 # CDDL HEADER END
 #
 
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
 
 import testutils
 if __name__ == "__main__":
@@ -30,8 +30,11 @@
 
 try:
         import ldtp
+        import ldtputils
+        if not "getmin" in dir(ldtp):
+            raise ImportError
 except ImportError:
-        raise ImportError, "SUNWldtp package not installed."
+        raise ImportError, "ldtp 2.X package not installed."
 
 class TestPkgGuiHelp(pkg5unittest.SingleDepotTestCase):
         # Only start/stop the depot once (instead of for every test)
@@ -47,17 +50,18 @@
 
         def setUp(self, debug_features=None):
                 pkg5unittest.SingleDepotTestCase.setUp(self)
-                repo_url = self.dc.get_depot_url()
-                self.pkgsend_bulk(repo_url, self.foo10)
-                self.image_create(repo_url)
+                self.pkgsend_bulk(self.rurl, self.foo10)
+                self.image_create(self.rurl)
+                self.pm_str = "%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area
 
         def tearDown(self):
                 pkg5unittest.SingleDepotTestCase.tearDown(self)
 
         def testPmHelp(self):
-                ldtp.launchapp("%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area)
+                ldtp.launchapp(self.pm_str,["-R", self.get_img_path()])
+                ldtp.waittillguiexist('Package Manager', state = ldtp.state.ENABLED)
 
-                ldtp.click('frmPackageManager', 'mnuContents')
+                ldtp.selectmenuitem('Package Manager', 'mnuHelp;mnuContents')
 
                 # Verify result
                 ldtp.waittillguiexist('*Online Help')
@@ -65,13 +69,7 @@
 
                 ldtp.selectmenuitem('*Online Help', 'mnuCloseWindow')
 
-                # Quit UpdateManager
-                ldtp.click('frmPackageManager', 'mnuQuit')
-
-        def testPmAbout(self):
-                ldtp.launchapp("%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area)
-
-                ldtp.selectmenuitem('frmPackageManager', 'mnuAbout')
+                ldtp.selectmenuitem('Package Manager', 'mnuHelp;mnuAbout')
 
                 # Verify result
                 self.assertEqual(ldtp.guiexist('About Package Manager'), 1)
@@ -80,7 +78,7 @@
                 ldtp.click('dlgAboutPackageManager', 'btnClose')
 
                 # Quit Package Manager
-                ldtp.selectmenuitem('frmPackageManager', 'mnuQuit')
+                ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuQuit')
 
 if __name__ == "__main__":
 	unittest.main()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/tests/gui/t_pm_install.py	Mon May 09 19:45:50 2011 +0200
@@ -0,0 +1,86 @@
+#!/usr/bin/python
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
+
+import testutils
+if __name__ == "__main__":
+        testutils.setup_environment("../../../proto")
+import pkg5unittest
+import unittest
+
+try:
+        import ldtp
+        import ldtputils
+        if not "getmin" in dir(ldtp):
+            raise ImportError
+except ImportError:
+        raise ImportError, "ldtp 2.X package not installed."
+
+class TestPkgGuiInstallBasics(pkg5unittest.SingleDepotTestCase):
+
+        # pygtk requires unicode as the default encoding.
+        default_utf8 = True
+
+        foo10 = """
+            open [email protected],5.11-0
+            add set name="description" value="Some package1 description"
+            close """
+
+        def setUp(self):
+                pkg5unittest.SingleDepotTestCase.setUp(self)
+
+        def tearDown(self):
+                pkg5unittest.SingleDepotTestCase.tearDown(self)
+
+        def testInstallSimplePackage(self):
+                pkgname = 'package1'
+                pm_str = "%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area
+
+                self.pkgsend_bulk(self.rurl, self.foo10)
+                self.image_create(self.rurl)
+
+                ldtp.launchapp(pm_str,["-R", self.get_img_path()])
+                ldtp.waittillguiexist('Package Manager', state = ldtp.state.ENABLED)
+                ldtp.selectindex('Package Manager', 'Publisher', 0)
+                ldtp.selectrow('Package Manager', 'Packages', pkgname)
+                ldtp.selectmenuitem('Package Manager', 'mnuEdit;mnuSelect All')
+                ldtp.click('Package Manager', 'btnInstall/Update')
+                ldtp.waittillguiexist('dlgInstall Confirmation')
+                ldtp.click('dlgInstall Confirmation', 'btnProceed')
+
+                while (ldtp.objectexist('dlgInstall/Update', 'btnClose') == 0):
+                        ldtp.wait(0.1)
+
+                ldtp.click('dlgInstall/Update', 'btnClose')
+
+                ldtp.waittillguinotexist('dlgInstall/Update')
+
+                # Verify result
+                self.pkg('verify')
+
+                # Quit packagemanager
+                ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuQuit')
+                
+
+if __name__ == "__main__":
+	unittest.main()
--- a/src/tests/gui/t_pm_install_py	Sat May 07 00:25:10 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-#!/usr/bin/python
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
-
-from cli import testutils
-
-if __name__ == "__main__":
-        testutils.setup_environment("../../../proto")
-
-try:
-        import ldtp
-except ImportError:
-        raise ImportError, "SUNWldtp package not installed."
-
-class TestPkgGuiInstallBasics(testutils.SingleDepotTestCase):
-        # Only start/stop the depot once (instead of for every test)
-        persistent_depot = True
-
-        # pygtk requires unicode as the default encoding.
-        default_utf8 = True
-
-        foo10 = """
-            open [email protected],5.11-0
-            add set name="description" value="Some package1 description"
-            close """
-
-        def setUp(self, debug_features=None):
-                testutils.SingleDepotTestCase.setUp(self)
-
-        def tearDown(self):
-                testutils.SingleDepotTestCase.tearDown(self)
-
-        def testInstallSimplePackage(self):
-                pkgname = 'package1'
-                repo_url = self.dc.get_depot_url()
-                self.pkgsend_bulk(repo_url, self.foo10)
-                self.image_create(repo_url)
-                ldtp.launchapp("%s/usr/bin/packagemanager" % testutils.g_proto_area)
-
-                ldtp.waittillguinotexist('dlgLoading Repository Information')
-
-                ldtp.activatetext('frmPackageManager', 'txtSearch')
-                ldtp.enterstring('frmPackageManager', 'txtSearch', pkgname)
-                ldtp.generatekeyevent('<enter>')
-
-                # Select the package to install
-                ldtp.selectrow('frmPackageManager', 'Packages', pkgname)
-                ldtp.click('frmPackageManager', 'btnInstall/Update')
-
-                # Instead of doing wait(5) we are currently waiting for the object
-                # "close button" in the loop
-                # when objectexist() == 1 the loop will break
-                while (ldtp.objectexist('dlgInstall/Update', 'btnClose') == 0):
-                        ldtp.wait(0.1)
-
-                # Get focus to the Install/Update dialog
-                ldtp.click('dlgInstall/Update', 'btnClose')
-                
-                ldtp.waittillguinotexist('dlgInstall/Update')
-
-                self.pkg("list")
-                self.pkg("verify")
-
-                # Quit packagemanager
-                ldtp.click('frmPackageManager', 'mnuQuit')
--- a/src/tests/gui/t_pm_rmrepo.py	Sat May 07 00:25:10 2011 -0700
+++ b/src/tests/gui/t_pm_rmrepo.py	Mon May 09 19:45:50 2011 +0200
@@ -20,7 +20,7 @@
 # CDDL HEADER END
 #
 
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
 
 import testutils
 if __name__ == "__main__":
@@ -30,8 +30,11 @@
 
 try:
         import ldtp
+        import ldtputils
+        if not "getmin" in dir(ldtp):
+            raise ImportError
 except ImportError:
-        raise ImportError, "SUNWldtp package not installed."
+        raise ImportError, "ldtp 2.X package not installed."
 
 class TestPkgGuiRmRepoBasics(pkg5unittest.ManyDepotTestCase):
 
@@ -47,7 +50,8 @@
             close """
 
         def setUp(self):
-                pkg5unittest.ManyDepotTestCase.setUp(self, ["test1", "test2"])
+                pkg5unittest.ManyDepotTestCase.setUp(self, ["test1", "test2"],
+                    start_depots=True)
 
                 durl1 = self.dcs[1].get_depot_url()
                 self.pkgsend_bulk(durl1, self.foo1)
@@ -56,30 +60,36 @@
                 self.pkgsend_bulk(durl2, self.bar1)
 
                 self.image_create(durl1, prefix="test1")
+
                 self.pkg("set-publisher -O " + durl2 + " test2")
 
         def testRmRepository(self):
                 repo_name = "test2"
-
-                ldtp.launchapp("%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area)
+                pm_str = "%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area
+                ldtp.launchapp(pm_str,["-R", self.get_img_path()])
+                ldtp.waittillguiexist('Package Manager', state = ldtp.state.ENABLED)
 
-                ldtp.selectmenuitem('frmPackageManager', 'mnuManageRepositories')
+                ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuManage Publishers...')
                 
-                ldtp.waittillguiexist('dlgManageRepositories')
+                ldtp.waittillguiexist('dlgManage Publishers')
+
+                ldtp.selectrow('dlgManage Publishers', 'Publishers', repo_name)
 
-                ldtp.selectrow('dlgManageRepositories', 'Repositories', repo_name)
+                ldtp.click('dlgManage Publishers', 'btnRemove')
 
-                ldtp.click('dlgManageRepositories', 'btnRemove')
+                ldtp.click('dlgManage Publishers', 'btnOK')
 
-                ldtp.click('dlgManageRepositories', 'btnClose')
+                ldtp.waittillguiexist('dlgManage Publishers Confirmation')
 
-                ldtp.waittillguiexist('frmPackageManager')
+                ldtp.click('dlgManage Publishers Confirmation', 'btnOK')
+
+                ldtp.waittillguinotexist('dlgManage Publishers')
 
                 # Verify result
                 self.pkg('publisher | grep %s' % repo_name, exit=1)
 
                 # Quit Package Manager
-                ldtp.selectmenuitem('frmPackageManager', 'mnuQuit')
+                ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuQuit')
 
 if __name__ == "__main__":
 	unittest.main()
--- a/src/tests/gui/t_pm_start.py	Sat May 07 00:25:10 2011 -0700
+++ b/src/tests/gui/t_pm_start.py	Mon May 09 19:45:50 2011 +0200
@@ -20,7 +20,7 @@
 # CDDL HEADER END
 #
 
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
 
 import testutils
 if __name__ == "__main__":
@@ -30,8 +30,11 @@
 
 try:
         import ldtp
+        import ldtputils
+        if not "getmin" in dir(ldtp):
+            raise ImportError
 except ImportError:
-        raise ImportError, "SUNWldtp package not installed."
+        raise ImportError, "ldtp 2.X package not installed."
 
 class TestPkgGuiStartBasics(pkg5unittest.SingleDepotTestCase):
 
@@ -43,16 +46,21 @@
             add set name="description" value="Some package description"
             close """
 
-        def testStartPackagemanager(self):
-                durl = self.dc.get_depot_url()
-                self.pkgsend_bulk(durl, self.foo10)
+        def setUp(self):
+                pkg5unittest.SingleDepotTestCase.setUp(self)
+
+        def tearDown(self):
+                pkg5unittest.SingleDepotTestCase.tearDown(self)
 
-                # image_create destroys the previous image
-                # so it's not needed to call self.image_destroy()
-                self.image_create(durl)
+        def testStartPackagemanager(self):
+                pm_str = "%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area
 
-                ldtp.launchapp("%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area)
-                ldtp.click('frmPackageManager', 'mnuQuit')
+                self.pkgsend_bulk(self.rurl, self.foo10)
+                self.image_create(self.rurl)
+
+                ldtp.launchapp(pm_str,["-R", self.get_img_path()])
+                ldtp.waittillguiexist('Package Manager', state = ldtp.state.ENABLED)
+                ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuQuit')
 
 if __name__ == "__main__":
-	unittest.main()
+        unittest.main()
--- a/src/tests/gui/t_pm_uninstall.py	Sat May 07 00:25:10 2011 -0700
+++ b/src/tests/gui/t_pm_uninstall.py	Mon May 09 19:45:50 2011 +0200
@@ -20,7 +20,7 @@
 # CDDL HEADER END
 #
 
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
 
 import testutils
 if __name__ == "__main__":
@@ -30,8 +30,11 @@
 
 try:
         import ldtp
+        import ldtputils
+        if not "getmin" in dir(ldtp):
+            raise ImportError
 except ImportError:
-        raise ImportError, "SUNWldtp package not installed."
+        raise ImportError, "ldtp 2.X package not installed."
 
 class TestPkgGuiUninstallBasics(pkg5unittest.SingleDepotTestCase):
 
@@ -43,40 +46,42 @@
             add set name="description" value="Some package1 description"
             close """
 
+        def setUp(self):
+                pkg5unittest.SingleDepotTestCase.setUp(self)
+
+        def tearDown(self):
+                pkg5unittest.SingleDepotTestCase.tearDown(self)
+
         def testUninstallSimplePackage(self):
                 pkgname = 'package1'
-                repo_url = self.dc.get_depot_url()
-                self.pkgsend_bulk(repo_url, self.foo10)
-                self.image_create(repo_url)
+                pm_str = "%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area
+
+                self.pkgsend_bulk(self.rurl, self.foo10)
+                self.image_create(self.rurl)
                 self.pkg("install %s" % pkgname)
 
-                ldtp.launchapp("%s/usr/bin/packagemanager" % pkg5unittest.g_proto_area)
-
-                ldtp.activatetext('frmPackageManager', 'txtSearch')
-                ldtp.enterstring('frmPackageManager', 'txtSearch', pkgname)
-                
-                ldtp.generatekeyevent('<enter>')
-
-                # Select the package to remove
-                ldtp.selectrow('frmPackageManager', 'Packages', pkgname)
-                ldtp.click('frmPackageManager', 'btnRemove')
-
-                # Get focus to the Remove confirmation dialog
+                ldtp.launchapp(pm_str,["-R", self.get_img_path()])
+                ldtp.waittillguiexist('Package Manager', state = ldtp.state.ENABLED)
+                ldtp.selectrow('Package Manager', 'Categories', "All Categories")
+                ldtp.selectrow('Package Manager', 'Packages', pkgname)
+                ldtp.selectmenuitem('Package Manager', 'mnuEdit;mnuSelect All')
+                ldtp.click('Package Manager', 'btnRemove')
                 ldtp.waittillguiexist('dlgRemoveConfirmation')
                 ldtp.click('dlgRemoveConfirmation', 'btnProceed')
 
                 while (ldtp.objectexist('dlgRemove', 'btnClose') == 0):
                         ldtp.wait(0.1)
-                
+
                 ldtp.click('dlgRemove', 'btnClose')
 
-                # Quit packagemanager
                 ldtp.waittillguinotexist('dlgRemove')
 
                 # Verify result
                 self.pkg('verify')
 
-                ldtp.click('frmPackageManager', 'mnuQuit')
+                # Quit packagemanager
+                ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuQuit')
+                
 
 if __name__ == "__main__":
 	unittest.main()
--- a/src/tests/run.py	Sat May 07 00:25:10 2011 -0700
+++ b/src/tests/run.py	Mon May 09 19:45:50 2011 +0200
@@ -200,6 +200,7 @@
    -p             Parseable output format
    -s <regexp>    Run tests starting at regexp
    -t             Generate timing info file
+   -u             Enable IPS GUI tests, disabled by default
    -v             Verbose output
    -x             Stop after the first baseline mismatch
    -z <port>      Lowest port the test suite should use
@@ -218,7 +219,7 @@
                 # If you add options here, you need to also update setup.py's
                 # test_func to include said options.
                 #
-                opts, pargs = getopt.getopt(sys.argv[1:], "a:cdfghptvxb:o:s:z:",
+                opts, pargs = getopt.getopt(sys.argv[1:], "a:cdfghptuvxb:o:s:z:",
                     ["generate-baseline", "parseable", "port", "timing",
                     "verbose", "baseline-file", "only"])
         except getopt.GetoptError, e:
@@ -235,6 +236,7 @@
         do_coverage = False
         debug_output = False
         show_on_expected_fail = False
+        enable_gui_tests = False
         archive_dir = None
         port = 12001
 
@@ -255,6 +257,8 @@
                         bfile = arg
                 if opt == "-o":
                         onlyval.append(arg)
+                if opt == "-u":
+                        enable_gui_tests = True
                 if opt == "-x":
                         bailonfail = True
                 if opt == "-t":
@@ -315,21 +319,22 @@
         if ostype == "posix":
                 suites.append(cli_suite)
                 suites.append(distro_suite)
-                try:
-                        import gui.testutils
-                except Exception, e:
-                        print "# %s" % e
-                else:
-                        if not gui.testutils.check_for_gtk():
-                                print "# GTK not present or $DISPLAY not " \
-                                    "set, GUI tests disabled."
-                        elif not gui.testutils.check_if_a11y_enabled():
-                                print "# Accessibility not enabled, GUI " \
-                                    "tests disabled."
+                if enable_gui_tests:
+                        try:
+                                import gui.testutils
+                        except Exception, e:
+                                print "# %s" % e
                         else:
-                                gui_suite = find_tests("gui", onlyval,
-                                    startattest, output)
-                                suites.append(gui_suite)
+                                if not gui.testutils.check_for_gtk():
+                                        print "# GTK not present or $DISPLAY not " \
+                                            "set, GUI tests disabled."
+                                elif not gui.testutils.check_if_a11y_enabled():
+                                        print "# Accessibility not enabled, GUI " \
+                                            "tests disabled."
+                                else:
+                                        gui_suite = find_tests("gui", onlyval,
+                                            startattest, output)
+                                        suites.append(gui_suite)
 
         # This is primarily of interest to developers altering the test suite,
         # so don't enable it for now.  The testsuite suite tends to emit a bunch