Use default flake8 config
diff --git a/tests/check_builtin_literals_test.py b/tests/check_builtin_literals_test.py
index d4ac30f..dbb9cc4 100644
--- a/tests/check_builtin_literals_test.py
+++ b/tests/check_builtin_literals_test.py
@@ -2,9 +2,9 @@
import pytest
-from pre_commit_hooks.check_builtin_literals import BuiltinTypeCall
-from pre_commit_hooks.check_builtin_literals import BuiltinTypeVisitor
+from pre_commit_hooks.check_builtin_literals import Call
from pre_commit_hooks.check_builtin_literals import main
+from pre_commit_hooks.check_builtin_literals import Visitor
BUILTIN_CONSTRUCTORS = '''\
from six.moves import builtins
@@ -38,7 +38,7 @@
@pytest.fixture
def visitor():
- return BuiltinTypeVisitor()
+ return Visitor()
@pytest.mark.parametrize(
@@ -48,35 +48,35 @@
('x[0]()', []),
# complex
("0j", []),
- ("complex()", [BuiltinTypeCall('complex', 1, 0)]),
+ ("complex()", [Call('complex', 1, 0)]),
("complex(0, 0)", []),
("complex('0+0j')", []),
('builtins.complex()', []),
# float
("0.0", []),
- ("float()", [BuiltinTypeCall('float', 1, 0)]),
+ ("float()", [Call('float', 1, 0)]),
("float('0.0')", []),
('builtins.float()', []),
# int
("0", []),
- ("int()", [BuiltinTypeCall('int', 1, 0)]),
+ ("int()", [Call('int', 1, 0)]),
("int('0')", []),
('builtins.int()', []),
# list
("[]", []),
- ("list()", [BuiltinTypeCall('list', 1, 0)]),
+ ("list()", [Call('list', 1, 0)]),
("list('abc')", []),
("list([c for c in 'abc'])", []),
("list(c for c in 'abc')", []),
('builtins.list()', []),
# str
("''", []),
- ("str()", [BuiltinTypeCall('str', 1, 0)]),
+ ("str()", [Call('str', 1, 0)]),
("str('0')", []),
('builtins.str()', []),
# tuple
("()", []),
- ("tuple()", [BuiltinTypeCall('tuple', 1, 0)]),
+ ("tuple()", [Call('tuple', 1, 0)]),
("tuple('abc')", []),
("tuple([c for c in 'abc'])", []),
("tuple(c for c in 'abc')", []),
@@ -92,7 +92,7 @@
('expression', 'calls'),
[
("{}", []),
- ("dict()", [BuiltinTypeCall('dict', 1, 0)]),
+ ("dict()", [Call('dict', 1, 0)]),
("dict(a=1, b=2, c=3)", []),
("dict(**{'a': 1, 'b': 2, 'c': 3})", []),
("dict([(k, v) for k, v in [('a', 1), ('b', 2), ('c', 3)]])", []),
@@ -108,20 +108,22 @@
@pytest.mark.parametrize(
('expression', 'calls'),
[
- ("dict()", [BuiltinTypeCall('dict', 1, 0)]),
- ("dict(a=1, b=2, c=3)", [BuiltinTypeCall('dict', 1, 0)]),
- ("dict(**{'a': 1, 'b': 2, 'c': 3})", [BuiltinTypeCall('dict', 1, 0)]),
+ ("dict()", [Call('dict', 1, 0)]),
+ ("dict(a=1, b=2, c=3)", [Call('dict', 1, 0)]),
+ ("dict(**{'a': 1, 'b': 2, 'c': 3})", [Call('dict', 1, 0)]),
('builtins.dict()', []),
],
)
def test_dict_no_allow_kwargs_exprs(expression, calls):
- visitor = BuiltinTypeVisitor(allow_dict_kwargs=False)
+ visitor = Visitor(allow_dict_kwargs=False)
visitor.visit(ast.parse(expression))
assert visitor.builtin_type_calls == calls
def test_ignore_constructors():
- visitor = BuiltinTypeVisitor(ignore=('complex', 'dict', 'float', 'int', 'list', 'str', 'tuple'))
+ visitor = Visitor(ignore=(
+ 'complex', 'dict', 'float', 'int', 'list', 'str', 'tuple',
+ ))
visitor.visit(ast.parse(BUILTIN_CONSTRUCTORS))
assert visitor.builtin_type_calls == []
diff --git a/tests/detect_aws_credentials_test.py b/tests/detect_aws_credentials_test.py
index f1bd7d4..31ba33e 100644
--- a/tests/detect_aws_credentials_test.py
+++ b/tests/detect_aws_credentials_test.py
@@ -1,7 +1,7 @@
import pytest
from mock import patch
-from pre_commit_hooks.detect_aws_credentials import get_aws_credential_files_from_env
+from pre_commit_hooks.detect_aws_credentials import get_aws_cred_files_from_env
from pre_commit_hooks.detect_aws_credentials import get_aws_secrets_from_env
from pre_commit_hooks.detect_aws_credentials import get_aws_secrets_from_file
from pre_commit_hooks.detect_aws_credentials import main
@@ -35,9 +35,8 @@
),
)
def test_get_aws_credentials_file_from_env(env_vars, values):
- """Test that reading credential files names from environment variables works."""
with patch.dict('os.environ', env_vars, clear=True):
- assert get_aws_credential_files_from_env() == values
+ assert get_aws_cred_files_from_env() == values
@pytest.mark.parametrize(
@@ -107,12 +106,11 @@
),
)
def test_detect_aws_credentials(filename, expected_retval):
- """Test if getting configured AWS secrets from files to be checked in works."""
-
# with a valid credentials file
ret = main((
get_resource_path(filename),
- "--credentials-file=testing/resources/aws_config_with_multiple_sections.ini",
+ '--credentials-file',
+ 'testing/resources/aws_config_with_multiple_sections.ini',
))
assert ret == expected_retval
@@ -138,8 +136,9 @@
@patch('pre_commit_hooks.detect_aws_credentials.get_aws_secrets_from_file')
@patch('pre_commit_hooks.detect_aws_credentials.get_aws_secrets_from_env')
-def test_non_existent_credentials_with_allow_flag(mock_secrets_env, mock_secrets_file):
- """Test behavior with no configured AWS secrets and flag to allow when missing."""
+def test_non_existent_credentials_with_allow_flag(
+ mock_secrets_env, mock_secrets_file,
+):
mock_secrets_env.return_value = set()
mock_secrets_file.return_value = set()
ret = main((
diff --git a/tests/pretty_format_json_test.py b/tests/pretty_format_json_test.py
index 8d82d74..bf7a16f 100644
--- a/tests/pretty_format_json_test.py
+++ b/tests/pretty_format_json_test.py
@@ -57,7 +57,10 @@
def test_non_ascii_main():
- ret = main(['--no-ensure-ascii', get_resource_path('non_ascii_pretty_formatted_json.json')])
+ ret = main((
+ '--no-ensure-ascii',
+ get_resource_path('non_ascii_pretty_formatted_json.json'),
+ ))
assert ret == 0
@@ -79,17 +82,23 @@
def test_orderfile_get_pretty_format():
- ret = main(['--top-keys=alist', get_resource_path('pretty_formatted_json.json')])
+ ret = main((
+ '--top-keys=alist', get_resource_path('pretty_formatted_json.json'),
+ ))
assert ret == 0
def test_not_orderfile_get_pretty_format():
- ret = main(['--top-keys=blah', get_resource_path('pretty_formatted_json.json')])
+ ret = main((
+ '--top-keys=blah', get_resource_path('pretty_formatted_json.json'),
+ ))
assert ret == 1
def test_top_sorted_get_pretty_format():
- ret = main(['--top-keys=01-alist,alist', get_resource_path('top_sorted_json.json')])
+ ret = main((
+ '--top-keys=01-alist,alist', get_resource_path('top_sorted_json.json'),
+ ))
assert ret == 0
diff --git a/tests/requirements_txt_fixer_test.py b/tests/requirements_txt_fixer_test.py
index b3a7942..c7c6e47 100644
--- a/tests/requirements_txt_fixer_test.py
+++ b/tests/requirements_txt_fixer_test.py
@@ -15,13 +15,25 @@
(b'foo\n# comment at end\n', PASS, b'foo\n# comment at end\n'),
(b'foo\nbar\n', FAIL, b'bar\nfoo\n'),
(b'bar\nfoo\n', PASS, b'bar\nfoo\n'),
- (b'#comment1\nfoo\n#comment2\nbar\n', FAIL, b'#comment2\nbar\n#comment1\nfoo\n'),
- (b'#comment1\nbar\n#comment2\nfoo\n', PASS, b'#comment1\nbar\n#comment2\nfoo\n'),
+ (
+ b'#comment1\nfoo\n#comment2\nbar\n',
+ FAIL,
+ b'#comment2\nbar\n#comment1\nfoo\n',
+ ),
+ (
+ b'#comment1\nbar\n#comment2\nfoo\n',
+ PASS,
+ b'#comment1\nbar\n#comment2\nfoo\n',
+ ),
(b'#comment\n\nfoo\nbar\n', FAIL, b'#comment\n\nbar\nfoo\n'),
(b'#comment\n\nbar\nfoo\n', PASS, b'#comment\n\nbar\nfoo\n'),
(b'\nfoo\nbar\n', FAIL, b'bar\n\nfoo\n'),
(b'\nbar\nfoo\n', PASS, b'\nbar\nfoo\n'),
- (b'pyramid==1\npyramid-foo==2\n', PASS, b'pyramid==1\npyramid-foo==2\n'),
+ (
+ b'pyramid==1\npyramid-foo==2\n',
+ PASS,
+ b'pyramid==1\npyramid-foo==2\n',
+ ),
(b'ocflib\nDjango\nPyMySQL\n', FAIL, b'Django\nocflib\nPyMySQL\n'),
(
b'-e git+ssh://git_url@tag#egg=ocflib\nDjango\nPyMySQL\n',
diff --git a/tests/tests_should_end_in_test_test.py b/tests/tests_should_end_in_test_test.py
index 4eb98e7..2acfa17 100644
--- a/tests/tests_should_end_in_test_test.py
+++ b/tests/tests_should_end_in_test_test.py
@@ -12,7 +12,10 @@
def test_main_django_all_pass():
- ret = main(['--django', 'tests.py', 'test_foo.py', 'test_bar.py', 'tests/test_baz.py'])
+ ret = main((
+ '--django', 'tests.py', 'test_foo.py', 'test_bar.py',
+ 'tests/test_baz.py',
+ ))
assert ret == 0