From 6b4fd0f0c16e3e98b5a4108dd82561692e5b2fc9 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Mon, 20 Sep 2010 10:03:55 +0000 Subject: [PATCH] Ignore certain lines for code coverage. svn path=/plone.app.discussion/trunk/; revision=40083 --- plone/app/discussion/browser/comments.py | 2 +- plone/app/discussion/browser/migration.py | 24 +++++++++++----------- plone/app/discussion/browser/moderation.py | 14 ++++++------- plone/app/discussion/browser/traversal.py | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/plone/app/discussion/browser/comments.py b/plone/app/discussion/browser/comments.py index 55ff7b0..518e0c7 100644 --- a/plone/app/discussion/browser/comments.py +++ b/plone/app/discussion/browser/comments.py @@ -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): diff --git a/plone/app/discussion/browser/migration.py b/plone/app/discussion/browser/migration.py index 0209bdb..20812dc 100644 --- a/plone/app/discussion/browser/migration.py +++ b/plone/app/discussion/browser/migration.py @@ -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) diff --git a/plone/app/discussion/browser/moderation.py b/plone/app/discussion/browser/moderation.py index 1853648..0803b2e 100644 --- a/plone/app/discussion/browser/moderation.py +++ b/plone/app/discussion/browser/moderation.py @@ -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 diff --git a/plone/app/discussion/browser/traversal.py b/plone/app/discussion/browser/traversal.py index 25ba6bd..d2f5814 100644 --- a/plone/app/discussion/browser/traversal.py +++ b/plone/app/discussion/browser/traversal.py @@ -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