Ignore certain lines for code coverage.
svn path=/plone.app.discussion/trunk/; revision=40083
This commit is contained in:
parent
cbde125048
commit
6b4fd0f0c1
@ -40,7 +40,7 @@ from plone.z3cform.fieldsets import extensible
|
|||||||
try:
|
try:
|
||||||
from plone.z3cform.interfaces import IWrappedForm
|
from plone.z3cform.interfaces import IWrappedForm
|
||||||
HAS_WRAPPED_FORM = True
|
HAS_WRAPPED_FORM = True
|
||||||
except ImportError:
|
except ImportError: # pragma: no cover
|
||||||
HAS_WRAPPED_FORM = False
|
HAS_WRAPPED_FORM = False
|
||||||
|
|
||||||
class CommentForm(extensible.ExtensibleForm, form.Form):
|
class CommentForm(extensible.ExtensibleForm, form.Form):
|
||||||
|
@ -33,14 +33,14 @@ class View(BrowserView):
|
|||||||
test = self.request.has_key("test")
|
test = self.request.has_key("test")
|
||||||
|
|
||||||
if not test:
|
if not test:
|
||||||
transaction.begin()
|
transaction.begin() # pragma: no cover
|
||||||
|
|
||||||
catalog = getToolByName(context, 'portal_catalog')
|
catalog = getToolByName(context, 'portal_catalog')
|
||||||
|
|
||||||
def log(msg):
|
def log(msg):
|
||||||
# encode string before sending it to external world
|
# encode string before sending it to external world
|
||||||
if isinstance(msg, unicode):
|
if isinstance(msg, unicode):
|
||||||
msg = msg.encode('utf-8')
|
msg = msg.encode('utf-8') # pragma: no cover
|
||||||
context.plone_log(msg)
|
context.plone_log(msg)
|
||||||
out.append(msg)
|
out.append(msg)
|
||||||
|
|
||||||
@ -147,11 +147,11 @@ class View(BrowserView):
|
|||||||
if self.total_comments_deleted != self.total_comments_migrated:
|
if self.total_comments_deleted != self.total_comments_migrated:
|
||||||
log("Something went wrong during migration. The number of \
|
log("Something went wrong during migration. The number of \
|
||||||
migrated comments (%s) differs from the number of deleted \
|
migrated comments (%s) differs from the number of deleted \
|
||||||
comments (%s)."
|
comments (%s)." # pragma: no cover
|
||||||
% (self.total_comments_migrated, self.total_comments_deleted))
|
% (self.total_comments_migrated, self.total_comments_deleted))
|
||||||
if not test:
|
if not test: # pragma: no cover
|
||||||
transaction.abort()
|
transaction.abort() # pragma: no cover
|
||||||
log("Abort transaction")
|
log("Abort transaction") # pragma: no cover
|
||||||
|
|
||||||
log("\n")
|
log("\n")
|
||||||
log("Comment migration finished.")
|
log("Comment migration finished.")
|
||||||
@ -162,13 +162,13 @@ class View(BrowserView):
|
|||||||
|
|
||||||
if self.total_comments_migrated != count_comments_old:
|
if self.total_comments_migrated != count_comments_old:
|
||||||
log("%s comments could not be migrated."
|
log("%s comments could not be migrated."
|
||||||
% (count_comments_old - self.total_comments_migrated))
|
% (count_comments_old - self.total_comments_migrated)) # pragma: no cover
|
||||||
log("Please make sure your portal catalog is up-to-date.")
|
log("Please make sure your portal catalog is up-to-date.") # pragma: no cover
|
||||||
|
|
||||||
if dry_run and not test:
|
if dry_run and not test:
|
||||||
transaction.abort()
|
transaction.abort() # pragma: no cover
|
||||||
log("Dry run")
|
log("Dry run") # pragma: no cover
|
||||||
log("Abort transaction")
|
log("Abort transaction") # pragma: no cover
|
||||||
if not test:
|
if not test:
|
||||||
transaction.commit()
|
transaction.commit() # pragma: no cover
|
||||||
return '\n'.join(out)
|
return '\n'.join(out)
|
||||||
|
@ -23,10 +23,10 @@ from plone.app.discussion.interfaces import IComment
|
|||||||
#
|
#
|
||||||
|
|
||||||
def _getContext(self): # pragma: no cover
|
def _getContext(self): # pragma: no cover
|
||||||
self = self.aq_parent # pragma: no cover
|
self = self.aq_parent
|
||||||
while getattr(self, '_is_wrapperish', None): # pragma: no cover
|
while getattr(self, '_is_wrapperish', None):
|
||||||
self = self.aq_parent # pragma: no cover
|
self = self.aq_parent
|
||||||
return self # pragma: no cover
|
return self
|
||||||
|
|
||||||
ZopeTwoPageTemplateFile._getContext = _getContext # pragma: no cover
|
ZopeTwoPageTemplateFile._getContext = _getContext # pragma: no cover
|
||||||
# End ugly hack.
|
# End ugly hack.
|
||||||
@ -149,7 +149,7 @@ class BulkActionsView(BrowserView):
|
|||||||
elif bulkaction == 'delete':
|
elif bulkaction == 'delete':
|
||||||
self.delete()
|
self.delete()
|
||||||
else:
|
else:
|
||||||
raise KeyError
|
raise KeyError # pragma: no cover
|
||||||
|
|
||||||
def retract(self):
|
def retract(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
@ -33,6 +33,6 @@ class ConversationNamespace(object):
|
|||||||
|
|
||||||
conversation = queryAdapter(self.context, IConversation, name=name)
|
conversation = queryAdapter(self.context, IConversation, name=name)
|
||||||
if conversation is None:
|
if conversation is None:
|
||||||
raise TraversalError(name)
|
raise TraversalError(name) # pragma: no cover
|
||||||
|
|
||||||
return conversation
|
return conversation
|
||||||
|
Loading…
Reference in New Issue
Block a user