← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~whydoubt/openlp/fix_platform_tests into lp:openlp

 

Jeffrey Smith has proposed merging lp:~whydoubt/openlp/fix_platform_tests into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)

For more details, see:
https://code.launchpad.net/~whydoubt/openlp/fix_platform_tests/+merge/189438

Consolidate two platform-specific tests into one platform-agnostic test

1. Running the Windows test on non-Windows makes no sense, and requires installing the icu library,
 which is only supposed to be a dependency for Windows.
2. Running the non-Windows test on Windows makes no sense, and for me the attempt simply fails.
3. To me, a solution along the lines of 'if windows, do x as mocked windows.  if non-windows, do x as mocked non-windows'
 is bizarre compared to simply 'do x', so that leaves us with consolidating the two tests.
-- 
https://code.launchpad.net/~whydoubt/openlp/fix_platform_tests/+merge/189438
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'tests/functional/openlp_core_utils/test_utils.py'
--- tests/functional/openlp_core_utils/test_utils.py	2013-10-02 21:37:00 +0000
+++ tests/functional/openlp_core_utils/test_utils.py	2013-10-04 21:58:25 +0000
@@ -150,35 +150,14 @@
         # THEN: The file name should be cleaned.
         self.assertEqual(wanted_name, result, 'The file name should not contain any special characters.')
 
-    def get_locale_key_windows_test(self):
-        """
-        Test the get_locale_key(string) function
-        """
-        with patch('openlp.core.utils.languagemanager.LanguageManager.get_language') as mocked_get_language,  \
-                patch('openlp.core.utils.os') as mocked_os:
-            # GIVEN: The language is German
-            # 0x00C3 (A with diaresis) should be sorted as "A". 0x00DF (sharp s) should be sorted as "ss".
-            mocked_get_language.return_value = 'de'
-            mocked_os.name = 'nt'
-            unsorted_list = ['Auszug', 'Aushang', '\u00C4u\u00DFerung']
-
-            # WHEN: We sort the list and use get_locale_key() to generate the sorting keys
-            sorted_list = sorted(unsorted_list, key=get_locale_key)
-
-            # THEN: We get a properly sorted list
-            self.assertEqual(['Aushang', '\u00C4u\u00DFerung', 'Auszug'], sorted_list,
-                'Strings should be sorted properly')
-
-    def get_locale_key_linux_test(self):
-        """
-        Test the get_locale_key(string) function
-        """
-        with patch('openlp.core.utils.languagemanager.LanguageManager.get_language') as mocked_get_language,  \
-                patch('openlp.core.utils.os.name') as mocked_os:
-            # GIVEN: The language is German
-            # 0x00C3 (A with diaresis) should be sorted as "A". 0x00DF (sharp s) should be sorted as "ss".
-            mocked_get_language.return_value = 'de'
-            mocked_os.name = 'linux'
+    def get_locale_key_test(self):
+        """
+        Test the get_locale_key(string) function
+        """
+        with patch('openlp.core.utils.languagemanager.LanguageManager.get_language') as mocked_get_language:
+            # GIVEN: The language is German
+            # 0x00C3 (A with diaresis) should be sorted as "A". 0x00DF (sharp s) should be sorted as "ss".
+            mocked_get_language.return_value = 'de'
             unsorted_list = ['Auszug', 'Aushang', '\u00C4u\u00DFerung']
 
             # WHEN: We sort the list and use get_locale_key() to generate the sorting keys


Follow ups