Add checking for inline #noqa comments

This also supports ignoring only specified codes
This commit is contained in:
Ian Cordasco 2016-02-19 09:08:24 -06:00
parent a9a939cbbc
commit f4b18229a0
2 changed files with 53 additions and 3 deletions

View file

@ -142,7 +142,8 @@ def test_handle_error_notifies_listeners(select_list, ignore_list, error_code):
listener_trie=listener_trie,
formatter=formatter)
guide.handle_error(error_code, 'stdin', 1, 1, 'error found')
with mock.patch('linecache.getline', return_value=''):
guide.handle_error(error_code, 'stdin', 1, 1, 'error found')
error = style_guide.Error(error_code, 'stdin', 1, 1, 'error found')
listener_trie.notify.assert_called_once_with(error_code, error)
formatter.handle.assert_called_once_with(error)
@ -170,6 +171,7 @@ def test_handle_error_does_not_notify_listeners(select_list, ignore_list,
listener_trie=listener_trie,
formatter=formatter)
guide.handle_error(error_code, 'stdin', 1, 1, 'error found')
with mock.patch('linecache.getline', return_value=''):
guide.handle_error(error_code, 'stdin', 1, 1, 'error found')
assert listener_trie.notify.called is False
assert formatter.handle.called is False