linter: Fix tests ignoring rules with `include_only`.

This commit is contained in:
derAnfaenger 2017-11-08 19:18:15 +01:00 committed by Tim Abbott
parent 5703b38ffb
commit 88794ea361
1 changed files with 2 additions and 1 deletions

View File

@ -62,5 +62,6 @@ class TestCustomRules(TestCase):
# create=True is superfluous when mocking built-ins in Python >= 3.5 # create=True is superfluous when mocking built-ins in Python >= 3.5
with patch('builtins.open', with patch('builtins.open',
return_value=iter((line+'\n\n').splitlines()), create=True, autospec=True), patch('builtins.print'): return_value=iter((line+'\n\n').splitlines()), create=True, autospec=True), patch('builtins.print'):
self.assertTrue(custom_check_file('foo.bar', 'baz', [rule], ''), filename = list(rule.get('include_only', {'foo.bar'}))[0]
self.assertTrue(custom_check_file(filename, 'baz', [rule], ''),
"The pattern '{}' didn't match the line '{}' while it should.".format(pattern, line)) "The pattern '{}' didn't match the line '{}' while it should.".format(pattern, line))