def test_get_translations_data_path_darwin_frozen(self): """Test getting the location of the compiled translation files.""" self.patch(sys, 'platform', 'darwin') sys.frozen = 'yes' self.addCleanup(delattr, sys, 'frozen') self.patch(translation, '__file__', os.path.join('path', 'to', 'Main.app', 'ignore', 'me')) path = translation._get_translations_data_path() self.assertEqual(path, os.path.join('path', 'to', 'Main.app', 'Contents', 'Resources', 'translations'))
def test_get_translations_data_path_darwin_unfrozen_fallback(self): """Test that we use fallback on darwin when not frozen.""" self.patch(sys, 'platform', 'darwin') expected = "a-test-path" path = translation._get_translations_data_path(expected) self.assertEqual(path, expected)
def test_get_translations_data_path_linux(self): """Test that we use gettext defaults on linux.""" path = translation._get_translations_data_path() self.assertEqual(path, None)
def test_get_translations_data_path_darwin_unfrozen_nofallback(self): """Test that we use gettext defaults on darwin when not frozen.""" self.patch(sys, 'platform', 'darwin') path = translation._get_translations_data_path() self.assertEqual(path, None)