/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 bzrlib/tests/test_msgeditor.py

  • Committer: Wouter van Heyst
  • Date: 2006-06-06 12:06:20 UTC
  • mfrom: (1740 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: larstiq@larstiq.dyndns.org-20060606120620-50066b0951e4ef7c
merge bzr.dev 1740

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
    def test__get_editor(self):
133
133
        # Test that _get_editor can return a decent list of items
134
134
        bzr_editor = os.environ.get('BZR_EDITOR')
 
135
        visual = os.environ.get('VISUAL')
135
136
        editor = os.environ.get('EDITOR')
136
137
        try:
137
138
            os.environ['BZR_EDITOR'] = 'bzr_editor'
 
139
            os.environ['VISUAL'] = 'visual'
138
140
            os.environ['EDITOR'] = 'editor'
139
141
 
140
142
            ensure_config_dir_exists()
144
146
 
145
147
            editors = list(bzrlib.msgeditor._get_editor())
146
148
 
147
 
            self.assertEqual(['bzr_editor', 'config_editor', 'editor'],
148
 
                editors[:3])
 
149
            self.assertEqual(['bzr_editor', 'config_editor', 'visual',
 
150
                              'editor'], editors[:4])
149
151
 
150
152
            if sys.platform == 'win32':
151
 
                self.assertEqual(['wordpad.exe', 'notepad.exe'], editors[3:])
 
153
                self.assertEqual(['wordpad.exe', 'notepad.exe'], editors[4:])
152
154
            else:
153
 
                self.assertEqual(['vi', 'pico', 'nano', 'joe'], editors[3:])
 
155
                self.assertEqual(['/usr/bin/editor', 'vi', 'pico', 'nano',
 
156
                                  'joe'], editors[4:])
154
157
 
155
158
        finally:
156
159
            # Restore the environment
158
161
                del os.environ['BZR_EDITOR']
159
162
            else:
160
163
                os.environ['BZR_EDITOR'] = bzr_editor
 
164
            if visual is None:
 
165
                del os.environ['VISUAL']
 
166
            else:
 
167
                os.environ['VISUAL'] = visual
161
168
            if editor is None:
162
169
                del os.environ['EDITOR']
163
170
            else:
164
171
                os.environ['EDITOR'] = editor
165