/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_msgeditor.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-12 01:41:38 UTC
  • mto: (7143.16.20 even-more-cleanups)
  • mto: This revision was merged to the branch mainline in revision 7175.
  • Revision ID: jelmer@jelmer.uk-20181112014138-3b0zyx91cu3wdq3k
More PEP8 fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
 
49
49
def load_tests(loader, standard_tests, pattern):
50
50
    """Parameterize the test for tempfile creation with different encodings."""
51
 
    to_adapt, result = split_suite_by_re(standard_tests,
52
 
                                         "test__create_temp_file_with_commit_template_in_unicode_dir")
 
51
    to_adapt, result = split_suite_by_re(
 
52
        standard_tests,
 
53
        "test__create_temp_file_with_commit_template_in_unicode_dir")
53
54
    return multiply_tests(to_adapt, encoding_scenarios, result)
54
55
 
55
56
 
58
59
    def make_uncommitted_tree(self):
59
60
        """Build a branch with uncommitted unicode named changes in the cwd."""
60
61
        working_tree = self.make_branch_and_tree('.')
61
 
        b = working_tree.branch
62
62
        filename = u'hell\u00d8'
63
63
        try:
64
64
            self.build_tree_contents([(filename, b'contents of hello')])
200
200
            self.overrideEnv('BRZ_EDITOR', './fed.py')
201
201
 
202
202
    def test_edit_commit_message_without_infotext(self):
203
 
        working_tree = self.make_uncommitted_tree()
 
203
        self.make_uncommitted_tree()
204
204
        self.make_fake_editor()
205
205
 
206
206
        mutter('edit_commit_message without infotext')
208
208
                         msgeditor.edit_commit_message(''))
209
209
 
210
210
    def test_edit_commit_message_with_ascii_infotext(self):
211
 
        working_tree = self.make_uncommitted_tree()
 
211
        self.make_uncommitted_tree()
212
212
        self.make_fake_editor()
213
213
 
214
214
        mutter('edit_commit_message with ascii string infotext')
216
216
                         msgeditor.edit_commit_message('spam'))
217
217
 
218
218
    def test_edit_commit_message_with_unicode_infotext(self):
219
 
        working_tree = self.make_uncommitted_tree()
 
219
        self.make_uncommitted_tree()
220
220
        self.make_fake_editor()
221
221
 
222
222
        mutter('edit_commit_message with unicode infotext')
236
236
        self.make_uncommitted_tree()
237
237
        self.make_fake_editor()
238
238
        self.assertEqual('test message from fed\nstart message\n',
239
 
                         msgeditor.edit_commit_message('',
240
 
                                                       start_message='start message\n'))
 
239
                         msgeditor.edit_commit_message(
 
240
                             '', start_message='start message\n'))
241
241
        self.assertEqual('test message from fed\n',
242
 
                         msgeditor.edit_commit_message('',
243
 
                                                       start_message=''))
 
242
                         msgeditor.edit_commit_message(
 
243
                             '', start_message=''))
244
244
 
245
245
    def test_deleted_commit_message(self):
246
 
        working_tree = self.make_uncommitted_tree()
 
246
        self.make_uncommitted_tree()
247
247
 
248
248
        if sys.platform == 'win32':
249
249
            editor = 'cmd.exe /c del'
344
344
        # in default user encoding
345
345
        char = probe_bad_non_ascii(osutils.get_user_encoding())
346
346
        if char is None:
347
 
            self.skipTest('Cannot find suitable non-ascii character '
348
 
                          'for user_encoding (%s)' % osutils.get_user_encoding())
 
347
            self.skipTest(
 
348
                'Cannot find suitable non-ascii character '
 
349
                'for user_encoding (%s)' % osutils.get_user_encoding())
349
350
 
350
351
        self.make_fake_editor(message=char)
351
352
 
352
 
        working_tree = self.make_uncommitted_tree()
 
353
        self.make_uncommitted_tree()
353
354
        self.assertRaises(msgeditor.BadCommitMessageEncoding,
354
355
                          msgeditor.edit_commit_message, '')
355
356