Improved user-facing messages

Updated some (pylint) comments/docstrings.

BUG=

Review URL: https://codereview.chromium.org/102703004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/commit-queue@244775 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/async_push.py b/async_push.py
index 7571d0c..9908da9 100644
--- a/async_push.py
+++ b/async_push.py
@@ -59,17 +59,18 @@
 
 
 class AsyncPush(AsyncPushNoop):
-  """Sends HTTP Post in a background worker thread.
+  """Sends HTTP Post asynchronously to the tree status application.
 
-  Thread-safe.
+  This object uses a background worker thread, and is thread-safe.
   """
   _TERMINATE = object()
 
-  def __init__(self, url, password):
+  def __init__(self, url, password, resource='/receiver'):
     super(AsyncPush, self).__init__()
     assert url
     assert password
     self.url = url
+    self.resource = resource
     self.password = password
     self.queue = Queue.Queue()
     self.thread = threading.Thread(target=self._worker_thread)
@@ -111,7 +112,7 @@
           done = True
           logging.debug('Worker thread exiting')
           items.remove(self._TERMINATE)
-        url = self.url + '/receiver'
+        url = self.url + self.resource
         logging.debug('Sending %d items to %s' % (len(items), url))
         try:
           data = [('p', json.dumps(item)) for item in items]
diff --git a/pending_manager.py b/pending_manager.py
index 7548be2..3efb648 100644
--- a/pending_manager.py
+++ b/pending_manager.py
@@ -148,14 +148,18 @@
   # Delay (secs) between commit bursts.
   COMMIT_BURST_DELAY = 10*60
 
-  def __init__(self, context_obj, pre_patch_verifiers, verifiers):
+  def __init__(self, context_obj, pre_patch_verifiers, verifiers,
+               project_name=''):
     """
     Args:
       pre_patch_verifiers: Verifiers objects that are run before applying the
                            patch.
       verifiers: Verifiers object run after applying the patch.
     """
-    assert len(pre_patch_verifiers) or len(verifiers)
+    if not(len(pre_patch_verifiers) or len(verifiers)):
+      raise ValueError('at least one verifier should be defined (in project %s)'
+                       % project_name)
+
     self.context = context_obj
     self.pre_patch_verifiers = pre_patch_verifiers or []
     self.verifiers = verifiers or []
@@ -429,6 +433,7 @@
             'Failed to set the flag to False for %s with message %s' % (
               pending.pending_name(), message))
         traceback.print_stack()
+        logging.error(str(e))
         errors.send_stack(e)
       if message:
         try:
diff --git a/tests/pending_manager_test.py b/tests/pending_manager_test.py
index efef86f..0407eae 100755
--- a/tests/pending_manager_test.py
+++ b/tests/pending_manager_test.py
@@ -165,19 +165,22 @@
 
   def testNoVerification(self):
     try:
-      # Need at least one verification.
       self._get_pc([], [])
-      self.fail()
-    except AssertionError:
+    except ValueError:
       pass
+    else:
+      self.fail(msg='A PendingManager must require at least one verifier.')
+
     try:
       # Cannot have the same verifier two times.
       self._get_pc(
           [fake.FakeVerifier(base.SUCCEEDED)],
           [fake.FakeVerifier(base.SUCCEEDED)])
-      self.fail()
     except AssertionError:
       pass
+    else:
+      self.fail(msg='A PendingManager should not accept the same verifier'
+                ' two times.')
 
   def _check_1(self, pc, result):
     issue = 31337