diff --git a/tests/functional/openlp_core_ui_media/test_vlcplayer.py b/tests/functional/openlp_core_ui_media/test_vlcplayer.py index b4f6fd1b5..b3ef0484a 100644 --- a/tests/functional/openlp_core_ui_media/test_vlcplayer.py +++ b/tests/functional/openlp_core_ui_media/test_vlcplayer.py @@ -23,6 +23,7 @@ Package to test the openlp.core.ui.media.vlcplayer package. """ import os +import sys from unittest import TestCase from tests.functional import patch @@ -35,14 +36,17 @@ class TestVLCPlayer(TestCase): Test the functions in the :mod:`vlcplayer` module. """ - @patch.dict(os.environ) @patch('openlp.core.ui.media.vlcplayer.is_macosx') def fix_vlc_22_plugin_path_test(self, mocked_is_macosx): """ Test that on OS X we set the VLC plugin path to fix a bug in the VLC module """ - # GIVEN: We're on OS X + # GIVEN: We're on OS X and we don't have the VLC plugin path set mocked_is_macosx.return_value = True + if 'VLC_PLUGIN_PATH' in os.environ: + del os.environ['VLC_PLUGIN_PATH'] + if 'openlp.core.ui.media.vendor.vlc' in sys.modules: + del sys.modules['openlp.core.ui.media.vendor.vlc'] # WHEN: An checking if the player is available get_vlc() @@ -58,8 +62,12 @@ class TestVLCPlayer(TestCase): """ Test that on Linux or some other non-OS X we do not set the VLC plugin path """ - # GIVEN: We're not on OS X + # GIVEN: We're not on OS X and we don't have the VLC plugin path set mocked_is_macosx.return_value = False + if 'VLC_PLUGIN_PATH' in os.environ: + del os.environ['VLC_PLUGIN_PATH'] + if 'openlp.core.ui.media.vendor.vlc' in sys.modules: + del sys.modules['openlp.core.ui.media.vendor.vlc'] # WHEN: An checking if the player is available get_vlc()