Fix OS X test which wasn't being skipped on non-OS X platforms

This commit is contained in:
Raoul Snyman 2016-01-06 22:00:51 +02:00
parent 607371a6d7
commit 51eefc84d9
1 changed files with 5 additions and 5 deletions

View File

@ -22,7 +22,7 @@
""" """
Package to test the openlp.core.ui.slidecontroller package. Package to test the openlp.core.ui.slidecontroller package.
""" """
from unittest import TestCase from unittest import TestCase, skipUnless
from PyQt5 import QtCore from PyQt5 import QtCore
@ -141,13 +141,14 @@ class TestMainDisplay(TestCase, TestMixin):
mocked_songs_plugin.refresh_css.assert_called_with(main_display.frame) mocked_songs_plugin.refresh_css.assert_called_with(main_display.frame)
mocked_bibles_plugin.refresh_css.assert_called_with(main_display.frame) mocked_bibles_plugin.refresh_css.assert_called_with(main_display.frame)
@patch('openlp.core.ui.maindisplay.is_macosx') @skipUnless(is_macosx(), 'Can only run test on Mac OS X due to pyobjc dependency.')
def macosx_display_window_flags_state_test(self, is_macosx): def macosx_display_window_flags_state_test(self, is_macosx):
""" """
Test that on Mac OS X we set the proper window flags Test that on Mac OS X we set the proper window flags
""" """
if not is_macosx():
self.skipTest('Can only run test on Mac OS X due to pyobjc dependency.')
# GIVEN: A new SlideController instance on Mac OS X. # GIVEN: A new SlideController instance on Mac OS X.
is_macosx.return_value = True
self.screens.set_current_display(0) self.screens.set_current_display(0)
display = MagicMock() display = MagicMock()
@ -159,12 +160,11 @@ class TestMainDisplay(TestCase, TestMixin):
main_display.windowFlags(), main_display.windowFlags(),
'The window flags should be Qt.Window, and Qt.FramelessWindowHint.') 'The window flags should be Qt.Window, and Qt.FramelessWindowHint.')
@skipUnless(is_macosx(), 'Can only run test on Mac OS X due to pyobjc dependency.')
def macosx_display_test(self): def macosx_display_test(self):
""" """
Test display on Mac OS X Test display on Mac OS X
""" """
if not is_macosx():
self.skipTest('Can only run test on Mac OS X due to pyobjc dependency.')
# GIVEN: A new SlideController instance on Mac OS X. # GIVEN: A new SlideController instance on Mac OS X.
self.screens.set_current_display(0) self.screens.set_current_display(0)
display = MagicMock() display = MagicMock()