Merge lp:~johnf-inodes/autoppa/editor into lp:autoppa

Proposed by John Ferlito
Status: Merged
Merged at revision: not available
Proposed branch: lp:~johnf-inodes/autoppa/editor
Merge into: lp:autoppa
Diff against target: 47 lines
2 files modified
autoppa/target.py (+3/-0)
autoppa/tests/test_target.py (+4/-1)
To merge this branch: bzr merge lp:~johnf-inodes/autoppa/editor
Reviewer Review Type Date Requested Status
Jamu Kakar Approve
Review via email: mp+13704@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Jamu Kakar (jkakar) wrote :

Thanks for the changes! I've merged it with some minor tweaks:

- I removed BuildTarget.default_editor and added a module-level
  DEFAULT_EDITOR constant and updated the test to match the change.

- I fixed the typo in the path to sensible-editor.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'autoppa/target.py'
2--- autoppa/target.py 2009-09-21 01:35:24 +0000
3+++ autoppa/target.py 2009-10-21 13:05:20 +0000
4@@ -73,6 +73,7 @@
5 self.system = system
6 self.version_replacement = True
7 self._prepared_files = set()
8+ self.default_editor = "/usr/bin/sensible_editor"
9
10 def _log_info(self, message):
11 """Write C{message} the log, if one is present."""
12@@ -99,6 +100,8 @@
13 editor = os.environ["VISUAL"]
14 elif "EDITOR" in os.environ:
15 editor = os.environ["EDITOR"]
16+ elif os.path.exists(self.default_editor):
17+ editor = self.default_editor
18 else:
19 raise EditorError("The VISUAL or EDITOR environment variable must "
20 "be set to prepare the changelog.")
21
22=== modified file 'autoppa/tests/test_target.py'
23--- autoppa/tests/test_target.py 2009-09-21 01:20:28 +0000
24+++ autoppa/tests/test_target.py 2009-10-21 13:05:20 +0000
25@@ -73,7 +73,7 @@
26 self.assertEquals(commands[1], ("run", command,
27 {"log_file": None, "timeout": None}))
28
29- def test_prepare_changelog_without_editor_environment_variable(self):
30+ def test_prepare_changelog_without_editor_environment_or_default_cmd(self):
31 """
32 L{BuildTarget.prepare_changelog} relies on a VISUAL or EDITOR
33 environment variable. An L{EditorError} is raised when they're not
34@@ -83,10 +83,13 @@
35 try:
36 if original_editor:
37 del os.environ["EDITOR"]
38+ original_default_editor = self.builder.default_editor
39+ self.builder.default_editor = "/tmp/random_path/that/doesn't exist"
40 self.assertRaises(EditorError, self.builder.prepare_changelog)
41 finally:
42 if original_editor is not None:
43 os.environ["EDITOR"] = original_editor
44+ self.builder.default_editor = original_default_editor
45
46 def test_prepare_changelog_without_content(self):
47 """

Subscribers

People subscribed via source and target branches

to all changes: