Ignore certain lines for code coverage.

svn path=/plone.app.discussion/trunk/; revision=40083
This commit is contained in:
Timo Stollenwerk 2010-09-20 10:03:55 +00:00
parent cbde125048
commit 6b4fd0f0c1
4 changed files with 21 additions and 21 deletions

View File

@ -40,7 +40,7 @@ from plone.z3cform.fieldsets import extensible
try:
from plone.z3cform.interfaces import IWrappedForm
HAS_WRAPPED_FORM = True
except ImportError:
except ImportError: # pragma: no cover
HAS_WRAPPED_FORM = False
class CommentForm(extensible.ExtensibleForm, form.Form):

View File

@ -33,14 +33,14 @@ class View(BrowserView):
test = self.request.has_key("test")
if not test:
transaction.begin()
transaction.begin() # pragma: no cover
catalog = getToolByName(context, 'portal_catalog')
def log(msg):
# encode string before sending it to external world
if isinstance(msg, unicode):
msg = msg.encode('utf-8')
msg = msg.encode('utf-8') # pragma: no cover
context.plone_log(msg)
out.append(msg)
@ -147,11 +147,11 @@ class View(BrowserView):
if self.total_comments_deleted != self.total_comments_migrated:
log("Something went wrong during migration. The number of \
migrated comments (%s) differs from the number of deleted \
comments (%s)."
comments (%s)." # pragma: no cover
% (self.total_comments_migrated, self.total_comments_deleted))
if not test:
transaction.abort()
log("Abort transaction")
if not test: # pragma: no cover
transaction.abort() # pragma: no cover
log("Abort transaction") # pragma: no cover
log("\n")
log("Comment migration finished.")
@ -162,13 +162,13 @@ class View(BrowserView):
if self.total_comments_migrated != count_comments_old:
log("%s comments could not be migrated."
% (count_comments_old - self.total_comments_migrated))
log("Please make sure your portal catalog is up-to-date.")
% (count_comments_old - self.total_comments_migrated)) # pragma: no cover
log("Please make sure your portal catalog is up-to-date.") # pragma: no cover
if dry_run and not test:
transaction.abort()
log("Dry run")
log("Abort transaction")
transaction.abort() # pragma: no cover
log("Dry run") # pragma: no cover
log("Abort transaction") # pragma: no cover
if not test:
transaction.commit()
transaction.commit() # pragma: no cover
return '\n'.join(out)

View File

@ -22,13 +22,13 @@ from plone.app.discussion.interfaces import IComment
# Bug report: https://bugs.launchpad.net/zope2/+bug/176566
#
def _getContext(self): # pragma: no cover
self = self.aq_parent # pragma: no cover
while getattr(self, '_is_wrapperish', None): # pragma: no cover
self = self.aq_parent # pragma: no cover
return self # pragma: no cover
def _getContext(self): # pragma: no cover
self = self.aq_parent
while getattr(self, '_is_wrapperish', None):
self = self.aq_parent
return self
ZopeTwoPageTemplateFile._getContext = _getContext # pragma: no cover
ZopeTwoPageTemplateFile._getContext = _getContext # pragma: no cover
# End ugly hack.
@ -149,7 +149,7 @@ class BulkActionsView(BrowserView):
elif bulkaction == 'delete':
self.delete()
else:
raise KeyError
raise KeyError # pragma: no cover
def retract(self):
raise NotImplementedError

View File

@ -33,6 +33,6 @@ class ConversationNamespace(object):
conversation = queryAdapter(self.context, IConversation, name=name)
if conversation is None:
raise TraversalError(name)
raise TraversalError(name) # pragma: no cover
return conversation