severity module

severity.load(rules)[source]

Parses severities section of the conf file and returns a dict of test name to severity level for tests.

>>> load([{'test_name': 'test_foo', 'severity': 'ERROR'}])
{'test_foo': 'ERROR'}
>>> load([{'test_name': '*', 'severity': 'INFO'}])  
defaultdict(<function load.<locals>.<lambda> at 0x...>, {})
>>> load([
... {'test_name': 'test_foo', 'severity': 'ERROR'}, {'test_name': 'test_bar', 'severity': 'INFO'}
... ]) == {'test_foo': 'ERROR', 'test_bar': 'INFO'}
True

Invalid severity levels are skipped with a warning:

>>> load([{'test_name': 'test_foo', 'severity': 'AHHH!'}])
{}
>>> # UserWarning: Line 0: Skipping line with invalid severity level 'AHHH!'

Duplicate test names are ignored with a warning:

>>> load([
... {'test_name': 'test_foo', 'severity': 'ERROR'}, {'test_name': 'test_foo', 'severity': 'INFO'}
... ]) == {'test_foo': 'ERROR'}
True
>>> # UserWarning: Line 1: Skipping line with duplicate test name 'test_foo'

Does not check that test names exist (since they might not be collected).

severity.add_severity_marker(item)[source]

Adds severity markers as specified in the severity conf.

Warns when overriding an existing test severity.