Skip to content

Support blacklisting warning categories from being reported to backslash (closes #68) #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions backslash/contrib/slash_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ def get_default_config(self):

"session_labels": [] // Doc('Specify labels to be added to the session when reported') \
// Cmdline(append="--session-label", metavar="LABEL"),
"blacklisted_warnings_category": [] // Doc(
'Specify warnings categories which should not be reported to backslash'),
}


Expand Down Expand Up @@ -157,7 +159,7 @@ def session_start(self):
except Exception: # pylint: disable=broad-except
raise

for label in slash_config.root.plugin_config.backslash.session_labels:
for label in self.current_config.session_labels:
self.client.api.call.add_label(session_id=self.session.id, label=label)

if self._keepalive_interval is not None:
Expand All @@ -183,7 +185,7 @@ def _get_initial_session_metadata(self):

def _get_extra_session_start_kwargs(self):
returned = {}
ttl_seconds = slash_config.root.plugin_config.backslash.session_ttl_days * 24 * 60 * 60
ttl_seconds = self.current_config.session_ttl_days * 24 * 60 * 60
if ttl_seconds:
returned['ttl_seconds'] = ttl_seconds
return returned
Expand Down Expand Up @@ -467,6 +469,8 @@ def _add_exception(self, result, exception, is_interruption=False):

@handle_exceptions
def warning_added(self, warning):
if any(issubclass(warning.category, b_cls) for b_cls in self.current_config.blacklisted_warnings_category):
return
kwargs = {'message': warning.message, 'filename': warning.filename, 'lineno': warning.lineno}
warning_obj = self.current_test if self.current_test is not None else self.session
if warning_obj is not None:
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Changelog
=========

* :feature:`68` Support blacklisting warning categories from being reported to backslash
* :release:`2.33.1 <30-1-2018>`
* :bug:`63` Avoid accidental deprecation when examining exception attributes
* :release:`2.33.0 <2-1-2018>`
Expand Down