Skip to content

Commit

Permalink
Don't run gui tests by default
Browse files Browse the repository at this point in the history
Since we're planning on not supporting the GUI w/ Python 3, and they
were causing issues on F27 (segfaults!) that were non-trivial to
determine the root cause of, we'll just stop running them by default.

Ran into these issues while developing #1761, so it may be necessary to
pull these changes in to test that PR against Python 3...

C-I should still be running them by using a different config file for
nose.
  • Loading branch information
kahowell committed Jan 19, 2018
1 parent 70074dc commit a2d4f0e
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 16 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ can be used:

See `cockpit/README.md` for more detailed information on cockpit development.

Testing
-------
We run tests using nose (see candlepinproject.org for details). Some tests
are not run by default. For example, since we are not maintaining the GTK GUI
for all platforms, they are not run by default. They can be included via
`-a gui` option for the nose command. It is recommended if you run the GUI
tests to also use `--with-xvfb` in order to use Xvfb instead of spawning
GTK windows in your desktop session (ex. `nosetests -a gui --with-xvfb`).

Troubleshooting
---------------

Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

[nosetests]
with-xvfb=True
with-randomly=True
cover-html=True
# exclude tests with names that match regex .*ga_impls.*
# Even though there are no tests with that name, but nose tries
# to load modules that would have that name, and seems to ignore 'ignore-files'
# Workaround for nose/ga/pygobject issues introduced with pygobject3-3.14
exclude=.*ga_impls.*
attr=!zypper,!functional
attr=!zypper,!functional,!gui
Empty file added test/gui/__init__.py
Empty file.
4 changes: 3 additions & 1 deletion test/test_about.py → test/gui/test_about.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@

from subscription_manager.ga import Gtk as ga_Gtk
from subscription_manager.gui import about
from .fixture import OPEN_FUNCTION
from test.fixture import OPEN_FUNCTION
from nose.plugins.attrib import attr


@attr('gui')
class TestAboutDialog(unittest.TestCase):
@mock.patch('subscription_manager.gui.about.get_server_versions')
@mock.patch('subscription_manager.gui.about.get_client_versions')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from dateutil.tz import tzutc

from subscription_manager.gui import contract_selection
from nose.plugins.attrib import attr


def stubSelectedCallback(self, pool):
Expand All @@ -19,6 +20,7 @@ def stubCancelCallback(self):
pass


@attr('gui')
class ContractSelection(unittest.TestCase):
pool = {'productName': 'SomeProduct',
'consumed': 3,
Expand Down
6 changes: 4 additions & 2 deletions test/test_facts_gui.py → test/gui/test_facts_gui.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from __future__ import print_function, division, absolute_import

from .fixture import SubManFixture
from test.fixture import SubManFixture

from subscription_manager.injection import provide, IDENTITY
from .stubs import StubUEP, StubFacts
from test.stubs import StubUEP, StubFacts
from subscription_manager.gui import factsgui
from mock import NonCallableMock, patch
from nose.plugins.attrib import attr


@attr('gui')
class FactDialogTests(SubManFixture):

def setUp(self):
Expand Down
4 changes: 4 additions & 0 deletions test/test_gui_utils.py → test/gui/test_gui_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
from subscription_manager.ga import Gtk as ga_Gtk
from subscription_manager.gui import utils
from subscription_manager.gui import storage
from nose.plugins.attrib import attr

# we need gtk 2.18+ to do the right markup in likify
MIN_GTK_MAJOR = 2
MIN_GTK_MINOR = 18
MIN_GTK_MICRO = 0


@attr('gui')
class TestLinkify(unittest.TestCase):
no_url = "this does not have a url"
https_url = "https://www.redhat.com"
Expand Down Expand Up @@ -72,6 +74,7 @@ def test_example_2(self):
self.assertEqual(ret, self.expected_example_2)


@attr('gui')
class TestGatherGroup(unittest.TestCase):
def test_gather_group(self):
"""
Expand Down Expand Up @@ -99,6 +102,7 @@ def test_gather_group(self):
self.assertEqual(names, set(['root', 'child-1', 'child-2', 'grandchild-1']))


@attr('gui')
class TestGuiExceptionMapper(unittest.TestCase):
def test_restlib_exception_with_markup(self):
exception_mapper = utils.GuiExceptionMapper()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@
from rhsm.https import ssl

from subscription_manager.gui import utils
from .fixture import FakeException, FakeLogger
from test.fixture import FakeException, FakeLogger

import rhsm.connection as connection
from nose.plugins.attrib import attr


class FakeErrorWindow(object):
def __init__(self, msg, parent=None):
self.msg = msg


@attr('gui')
@patch('subscription_manager.gui.utils.log', FakeLogger())
@patch('subscription_manager.gui.utils.show_error_window', FakeErrorWindow)
class HandleGuiExceptionTests(unittest.TestCase):
Expand Down
7 changes: 5 additions & 2 deletions test/test_managergui.py → test/gui/test_managergui.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
from __future__ import print_function, division, absolute_import

from .fixture import SubManFixture
from test.fixture import SubManFixture
import mock

from . import stubs
from test import stubs
from subscription_manager.gui import managergui, registergui
from subscription_manager.injection import provide, \
PRODUCT_DATE_RANGE_CALCULATOR, PROD_DIR
from nose.plugins.attrib import attr


@attr('gui')
class TestManagerGuiMainWindow(SubManFixture):
def test_main_window(self):

Expand All @@ -20,6 +22,7 @@ def test_main_window(self):
prod_dir=stubs.StubProductDirectory([]))


@attr('gui')
class TestRegisterScreen(SubManFixture):
def test_register_screen(self):
registergui.RegisterDialog(stubs.StubBackend())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
from __future__ import print_function, division, absolute_import

from .fixture import SubManFixture
from test.fixture import SubManFixture
from subscription_manager.gui import networkConfig
import mock
import rhsm.connection as connection
import rhsm.config
import rhsm.utils
import socket
from . import stubs
from test import stubs
from nose.plugins.attrib import attr


@attr('gui')
class TestNetworkConfigDialog(SubManFixture):

def setUp(self):
Expand Down
6 changes: 4 additions & 2 deletions test/test_preferences.py → test/gui/test_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
import mock


from . import stubs
from test import stubs

from .fixture import SubManFixture
from test.fixture import SubManFixture
from subscription_manager.ga import Gdk as ga_Gdk

from subscription_manager.injection import require, IDENTITY

from subscription_manager.gui import preferences
from nose.plugins.attrib import attr

CONSUMER_DATA = {'autoheal': True,
'releaseVer': {'id': 1, 'releaseVer': '123123'},
Expand All @@ -41,6 +42,7 @@ def get_releases():
return ["123123", "1", "2", "4", "blippy"]


@attr('gui')
class TestPreferencesDialog(SubManFixture):
_getConsumerData = None

Expand Down
2 changes: 2 additions & 0 deletions test/test_progress_gui.py → test/gui/test_progress_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import unittest

from subscription_manager.gui import progress
from nose.plugins.attrib import attr


@attr('gui')
class TestProgress(unittest.TestCase):
def setUp(self):
self.pw = progress.Progress("test title", "this is a test label")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from mock import Mock, patch

from .fixture import SubManFixture
from test.fixture import SubManFixture

from .stubs import StubBackend, StubFacts
from test.stubs import StubBackend, StubFacts
from subscription_manager.gui.registergui import RegisterWidget, RegisterInfo, \
CredentialsScreen, ActivationKeyScreen, ChooseServerScreen, AsyncBackend, \
CREDENTIALS_PAGE, CHOOSE_SERVER_PAGE
Expand All @@ -15,8 +15,10 @@

import sys
import six
from nose.plugins.attrib import attr


@attr('gui')
class RegisterWidgetTests(SubManFixture):
def setUp(self):
super(RegisterWidgetTests, self).setUp()
Expand Down Expand Up @@ -145,6 +147,7 @@ def __init__(self):
self.facts = StubFacts(fact_dict=self.expected_facts)


@attr('gui')
class CredentialsScreenTests(SubManFixture):

def setUp(self):
Expand All @@ -170,6 +173,7 @@ def test_clear_credentials_dialog(self):
self.screen.consumer_name.get_text())


@attr('gui')
class ActivationKeyScreenTests(SubManFixture):
def setUp(self):
super(ActivationKeyScreenTests, self).setUp()
Expand All @@ -185,6 +189,7 @@ def test_split_activation_keys(self):
self.assertEqual(expected, result)


@attr('gui')
class ChooseServerScreenTests(SubManFixture):
def setUp(self):
super(ChooseServerScreenTests, self).setUp()
Expand Down Expand Up @@ -224,6 +229,7 @@ def test__on_default_button_clicked(self, config):
self.assertEqual(expected, result)


@attr('gui')
class AsyncBackendTests(SubManFixture):
def setUp(self):
super(AsyncBackendTests, self).setUp()
Expand Down
7 changes: 5 additions & 2 deletions test/test_repogui.py → test/gui/test_repogui.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
#

from mock import Mock
from .fixture import SubManFixture
from test.fixture import SubManFixture
from subscription_manager.async import AsyncRepoOverridesUpdate
from subscription_manager.gui.reposgui import RepositoriesDialog
from subscription_manager.repolib import Repo
from subscription_manager.overrides import Override
from .stubs import StubEntitlementCertificate, StubProduct
from test.stubs import StubEntitlementCertificate, StubProduct
from nose.plugins.attrib import attr


@attr('gui')
class TestReposGui(SubManFixture):

def setUp(self):
Expand Down Expand Up @@ -166,6 +168,7 @@ def _get_combo_box_value(self, combo_box):
return combo_box.get_model()[column][1]


@attr('gui')
class TestingOverridesAsync(AsyncRepoOverridesUpdate):

def _process_callback(self, callback, *args):
Expand Down

0 comments on commit a2d4f0e

Please sign in to comment.