Merge lp:~tomasgroth/openlp/nose2-fixes into lp:openlp

Proposed by Tomas Groth
Status: Merged
Merged at revision: 2745
Proposed branch: lp:~tomasgroth/openlp/nose2-fixes
Merge into: lp:openlp
Diff against target: 205 lines (+34/-14)
8 files modified
openlp/core/ui/lib/pathedit.py (+4/-4)
openlp/plugins/presentations/presentationplugin.py (+1/-1)
openlp/plugins/songs/lib/importers/songshowplus.py (+3/-3)
openlp/plugins/songusage/forms/songusagedetaildialog.py (+1/-1)
tests/functional/openlp_plugins/songs/test_editverseform.py (+7/-1)
tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py (+8/-1)
tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py (+8/-1)
tests/resources/songshowplussongs/a mighty fortress is our god.json (+2/-2)
To merge this branch: bzr merge lp:~tomasgroth/openlp/nose2-fixes
Reviewer Review Type Date Requested Status
Tim Bentley Needs Fixing
Review via email: mp+324816@code.launchpad.net

Description of the change

Fixed songshowplus encoding issue.
Fixed issue where enable-chord settings was not setup correctly for tests.

To post a comment you must log in.
Revision history for this message
Tomas Groth (tomasgroth) wrote :
Revision history for this message
Tim Bentley (trb143) wrote :

Shame I have fixed most of these as well!

review: Approve
Revision history for this message
Tim Bentley (trb143) wrote :

Will have a conflict with themecleanup

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/ui/lib/pathedit.py'
2--- openlp/core/ui/lib/pathedit.py 2017-05-22 18:22:43 +0000
3+++ openlp/core/ui/lib/pathedit.py 2017-05-30 20:40:45 +0000
4@@ -46,16 +46,16 @@
5
6 :param parent: The parent of the widget. This is just passed to the super method.
7 :type parent: QWidget or None
8-
9+
10 :param dialog_caption: Used to customise the caption in the QFileDialog.
11 :param dialog_caption: str
12-
13+
14 :param default_path: The default path. This is set as the path when the revert button is clicked
15 :type default_path: str
16
17 :param show_revert: Used to determin if the 'revert button' should be visible.
18 :type show_revert: bool
19-
20+
21 :return: None
22 :rtype: None
23 """
24@@ -72,7 +72,7 @@
25 Set up the widget
26 :param show_revert: Show or hide the revert button
27 :type show_revert: bool
28-
29+
30 :return: None
31 :rtype: None
32 """
33
34=== modified file 'openlp/plugins/presentations/presentationplugin.py'
35--- openlp/plugins/presentations/presentationplugin.py 2017-05-22 18:27:40 +0000
36+++ openlp/plugins/presentations/presentationplugin.py 2017-05-30 20:40:45 +0000
37@@ -1,4 +1,4 @@
38- # -*- coding: utf-8 -*-
39+# -*- coding: utf-8 -*-
40 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
41
42 ###############################################################################
43
44=== modified file 'openlp/plugins/songs/lib/importers/songshowplus.py'
45--- openlp/plugins/songs/lib/importers/songshowplus.py 2016-12-31 11:01:36 +0000
46+++ openlp/plugins/songs/lib/importers/songshowplus.py 2017-05-30 20:40:45 +0000
47@@ -23,7 +23,6 @@
48 The :mod:`songshowplus` module provides the functionality for importing SongShow Plus songs into the OpenLP
49 database.
50 """
51-import chardet
52 import os
53 import logging
54 import re
55@@ -226,6 +225,7 @@
56
57 def decode(self, data):
58 try:
59- return str(data, chardet.detect(data)['encoding'])
60+ # Don't question this, it works...
61+ return data.decode('utf-8').encode('cp1251').decode('cp1251')
62 except:
63- return str(data, retrieve_windows_encoding())
64+ return data.decode(retrieve_windows_encoding())
65
66=== modified file 'openlp/plugins/songusage/forms/songusagedetaildialog.py'
67--- openlp/plugins/songusage/forms/songusagedetaildialog.py 2017-05-22 18:22:43 +0000
68+++ openlp/plugins/songusage/forms/songusagedetaildialog.py 2017-05-30 20:40:45 +0000
69@@ -69,7 +69,7 @@
70 self.file_horizontal_layout.setSpacing(8)
71 self.file_horizontal_layout.setContentsMargins(8, 8, 8, 8)
72 self.file_horizontal_layout.setObjectName('file_horizontal_layout')
73- self.report_path_edit = PathEdit(self.file_group_box, path_type = PathType.Directories, show_revert=False)
74+ self.report_path_edit = PathEdit(self.file_group_box, path_type=PathType.Directories, show_revert=False)
75 self.file_horizontal_layout.addWidget(self.report_path_edit)
76 self.vertical_layout.addWidget(self.file_group_box)
77 self.button_box = create_button_box(song_usage_detail_dialog, 'button_box', ['cancel', 'ok'])
78
79=== modified file 'tests/functional/openlp_plugins/songs/test_editverseform.py'
80--- tests/functional/openlp_plugins/songs/test_editverseform.py 2017-04-24 05:17:55 +0000
81+++ tests/functional/openlp_plugins/songs/test_editverseform.py 2017-05-30 20:40:45 +0000
82@@ -27,10 +27,15 @@
83
84 from PyQt5 import QtCore
85
86+from openlp.core.common import Settings
87 from openlp.plugins.songs.forms.editverseform import EditVerseForm
88
89 from tests.helpers.testmixin import TestMixin
90
91+__default_settings__ = {
92+ 'songs/enable chords': True,
93+}
94+
95
96 class TestEditVerseForm(TestCase, TestMixin):
97 """
98@@ -40,9 +45,10 @@
99 """
100 Set up the components need for all tests.
101 """
102- self.edit_verse_form = EditVerseForm(None)
103 self.setup_application()
104 self.build_settings()
105+ Settings().extend_default_settings(__default_settings__)
106+ self.edit_verse_form = EditVerseForm(None)
107 QtCore.QLocale.setDefault(QtCore.QLocale('en_GB'))
108
109 def tearDown(self):
110
111=== modified file 'tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py'
112--- tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py 2017-04-24 05:17:55 +0000
113+++ tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py 2017-05-30 20:40:45 +0000
114@@ -27,12 +27,16 @@
115
116 from PyQt5 import QtWidgets
117
118-from openlp.core.common import Registry
119+from openlp.core.common import Registry, Settings
120 from openlp.core.common.uistrings import UiStrings
121 from openlp.plugins.songs.forms.editsongform import EditSongForm
122
123 from tests.helpers.testmixin import TestMixin
124
125+__default_settings__ = {
126+ 'songs/enable chords': True,
127+}
128+
129
130 class TestEditSongForm(TestCase, TestMixin):
131 """
132@@ -48,12 +52,15 @@
133 self.main_window = QtWidgets.QMainWindow()
134 Registry().register('main_window', self.main_window)
135 Registry().register('theme_manager', MagicMock())
136+ self.build_settings()
137+ Settings().extend_default_settings(__default_settings__)
138 self.form = EditSongForm(MagicMock(), self.main_window, MagicMock())
139
140 def tearDown(self):
141 """
142 Delete all the C++ objects at the end so that we don't have a segfault
143 """
144+ self.destroy_settings()
145 del self.form
146 del self.main_window
147
148
149=== modified file 'tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py'
150--- tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py 2016-12-31 11:01:36 +0000
151+++ tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py 2017-05-30 20:40:45 +0000
152@@ -26,10 +26,14 @@
153
154 from PyQt5 import QtCore, QtTest, QtWidgets
155
156-from openlp.core.common import Registry
157+from openlp.core.common import Registry, Settings
158 from openlp.plugins.songs.forms.editverseform import EditVerseForm
159 from tests.helpers.testmixin import TestMixin
160
161+__default_settings__ = {
162+ 'songs/enable chords': True,
163+}
164+
165
166 class TestEditVerseForm(TestCase, TestMixin):
167 """
168@@ -44,12 +48,15 @@
169 self.setup_application()
170 self.main_window = QtWidgets.QMainWindow()
171 Registry().register('main_window', self.main_window)
172+ self.build_settings()
173+ Settings().extend_default_settings(__default_settings__)
174 self.form = EditVerseForm()
175
176 def tearDown(self):
177 """
178 Delete all the C++ objects at the end so that we don't have a segfault
179 """
180+ self.destroy_settings()
181 del self.form
182 del self.main_window
183
184
185=== modified file 'tests/resources/songshowplussongs/a mighty fortress is our god.json'
186--- tests/resources/songshowplussongs/a mighty fortress is our god.json 2014-05-03 08:47:31 +0000
187+++ tests/resources/songshowplussongs/a mighty fortress is our god.json 2017-05-30 20:40:45 +0000
188@@ -15,7 +15,7 @@
189 "v1"
190 ],
191 [
192- "Did we in our own strength confide, our striving would be losing;\r\nWere not the right Man on our side, the Man of God’s own choosing:\r\nDost ask who that may be? Christ Jesus, it is He;\r\nLord Sabaoth, His Name, from age to age the same,\r\nAnd He must win the battle.\r\n",
193+ "Did we in our own strength confide, our striving would be losing;\r\nWere not the right Man on our side, the Man of God’s own choosing:\r\nDost ask who that may be? Christ Jesus, it is He;\r\nLord Sabaoth, His Name, from age to age the same,\r\nAnd He must win the battle.\r\n",
194 "v2"
195 ],
196 [
197@@ -23,7 +23,7 @@
198 "v3"
199 ],
200 [
201- "That word above all earthly powers, no thanks to them, abideth;\r\nThe Spirit and the gifts are ours through Him Who with us sideth:\r\nLet goods and kindred go, this mortal life also;\r\nThe body they may kill: God’s truth abideth still,\r\nHis kingdom is forever.\r\n",
202+ "That word above all earthly powers, no thanks to them, abideth;\r\nThe Spirit and the gifts are ours through Him Who with us sideth:\r\nLet goods and kindred go, this mortal life also;\r\nThe body they may kill: God’s truth abideth still,\r\nHis kingdom is forever.\r\n",
203 "v4"
204 ]
205 ]