From e77fb4d6b952a69b692155c20f4ff248266944a1 Mon Sep 17 00:00:00 2001 From: Aaron Bentley Date: Tue, 17 May 2005 19:58:30 +0000 Subject: [PATCH] Added tests for missing $EDITOR Modified bug reports: ecc: no tests for missing $EDITOR status: open -> closed --- .be/bugs/ecc91b94-7f3f-44a7-af58-03191d327a7f/values | 2 +- becommands/comment.py | 4 ++++ libbe/utility.py | 12 +++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.be/bugs/ecc91b94-7f3f-44a7-af58-03191d327a7f/values b/.be/bugs/ecc91b94-7f3f-44a7-af58-03191d327a7f/values index bcb0409..555375b 100644 --- a/.be/bugs/ecc91b94-7f3f-44a7-af58-03191d327a7f/values +++ b/.be/bugs/ecc91b94-7f3f-44a7-af58-03191d327a7f/values @@ -15,7 +15,7 @@ severity=minor -status=open +status=closed diff --git a/becommands/comment.py b/becommands/comment.py index 6a7998c..c53fd87 100644 --- a/becommands/comment.py +++ b/becommands/comment.py @@ -33,6 +33,10 @@ def execute(args): True >>> comment.in_reply_to is None True + >>> del os.environ["EDITOR"] + >>> execute(["b"]) + Traceback (most recent call last): + UserError: No comment supplied, and EDITOR not specified. >>> os.environ["EDITOR"] = "echo 'I like cheese' > " >>> execute(["b"]) >>> dir.get_bug("b").list_comments()[0].body diff --git a/libbe/utility.py b/libbe/utility.py index a31d5d8..3d805cd 100644 --- a/libbe/utility.py +++ b/libbe/utility.py @@ -99,7 +99,17 @@ class CantFindEditor(Exception): Exception.__init__(self, "Can't find editor to get string from") def editor_string(): - """Invokes the editor, and returns the user_produced text as a string""" + + """Invokes the editor, and returns the user_produced text as a string + + >>> del os.environ["EDITOR"] + >>> editor_string() + Traceback (most recent call last): + CantFindEditor: Can't find editor to get string from + >>> os.environ["EDITOR"] = "echo bar > " + >>> editor_string() + 'bar\\n' + """ try: editor = os.environ["EDITOR"] except KeyError: -- 2.26.2