~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mail_client.py

  • Committer: Vincent Ladeuil
  • Date: 2009-09-02 08:26:27 UTC
  • mto: (4669.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4670.
  • Revision ID: v.ladeuil+lp@free.fr-20090902082627-cit8vm6tefu9hwk2
Cleanup emacs-bzr-send-XXXXXX.el leaks in /tmp during selftest.

* tests/test_mail_client.py:
(TestEmacsMail.test_commandline,
TestEmacsMail.test_commandline_is_8bit): Cleanup the generated tmp
file.

* mail_client.py:
(EmacsMail.__init__, EmacsMail._get_compose_commandline): Keep
track of the tmp file to ease cleanup during testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
424
424
 
425
425
    _client_commands = ['emacsclient']
426
426
 
 
427
    def __init__(self, config):
 
428
        super(EmacsMail, self).__init__(config)
 
429
        self.elisp_tmp_file = None
 
430
 
427
431
    def _prepare_send_function(self):
428
432
        """Write our wrapper function into a temporary file.
429
433
 
500
504
        if attach_path is not None:
501
505
            # Do not create a file if there is no attachment
502
506
            elisp = self._prepare_send_function()
 
507
            self.elisp_tmp_file = elisp
503
508
            lmmform = '(load "%s")' % elisp
504
509
            mmform  = '(bzr-add-mime-att "%s")' % \
505
510
                self._encode_path(attach_path, 'attachment')