aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
diff options
context:
space:
mode:
authorAaron Bentley <abentley@panoramicfeedback.com>2007-07-16 12:22:59 -0400
committerAaron Bentley <abentley@panoramicfeedback.com>2007-07-16 12:22:59 -0400
commite8d004d66e6de5bb29cc874290d2114cb7146d51 (patch)
treef2ac9727923fcb05f197b8f6af7f1fe2f32cc66b /libbe
parent25f31f1ca881d891adffb9b13ab0b8c7e0d3ec60 (diff)
downloadbugseverywhere-e8d004d66e6de5bb29cc874290d2114cb7146d51.tar.gz
Ensure that Arch tests have a user id set
Diffstat (limited to 'libbe')
-rw-r--r--libbe/arch.py20
-rw-r--r--libbe/tests.py1
2 files changed, 21 insertions, 0 deletions
diff --git a/libbe/arch.py b/libbe/arch.py
index b7c8a0b..624aea3 100644
--- a/libbe/arch.py
+++ b/libbe/arch.py
@@ -41,6 +41,25 @@ def invoke_client(*args, **kwargs):
raise Exception("Command failed: %s" % error)
return output
+def get_user_id():
+ try:
+ return invoke_client('my-id')
+ except Exception, e:
+ if 'no arch user id set' in e.args[0]:
+ return None
+ else:
+ raise
+
+
+def set_user_id(value):
+ invoke_client('my-id', value)
+
+
+def ensure_user_id():
+ if get_user_id() is None:
+ set_user_id('nobody <nobody@example.com>')
+
+
def write_tree_settings(contents, path):
file(os.path.join(path, "{arch}", "=tagging-method"), "wb").write(contents)
@@ -49,6 +68,7 @@ def init_tree(path):
def temp_arch_tree(type="easy"):
import tempfile
+ ensure_user_id()
path = tempfile.mkdtemp()
init_tree(path)
if type=="easy":
diff --git a/libbe/tests.py b/libbe/tests.py
index 2662df1..a7d925d 100644
--- a/libbe/tests.py
+++ b/libbe/tests.py
@@ -36,6 +36,7 @@ class Dir:
shutil.rmtree(self.name)
def arch_dir():
+ arch.ensure_user_id()
dir = Dir()
arch.init_tree(dir.name)
return dir