Remove @entry decorator (and misc cleanup)
diff --git a/tests/end_of_file_fixer_test.py b/tests/end_of_file_fixer_test.py
index 2e53246..3f0d0f0 100644
--- a/tests/end_of_file_fixer_test.py
+++ b/tests/end_of_file_fixer_test.py
@@ -18,21 +18,21 @@
)
-@pytest.mark.parametrize(('input', 'expected_retval', 'output'), TESTS)
-def test_fix_file(input, expected_retval, output):
+@pytest.mark.parametrize(('input_s', 'expected_retval', 'output'), TESTS)
+def test_fix_file(input_s, expected_retval, output):
file_obj = io.BytesIO()
- file_obj.write(input)
+ file_obj.write(input_s)
ret = fix_file(file_obj)
assert file_obj.getvalue() == output
assert ret == expected_retval
-@pytest.mark.parametrize(('input', 'expected_retval', 'output'), TESTS)
-def test_integration(input, expected_retval, output, tmpdir):
+@pytest.mark.parametrize(('input_s', 'expected_retval', 'output'), TESTS)
+def test_integration(input_s, expected_retval, output, tmpdir):
file_path = os.path.join(tmpdir.strpath, 'file.txt')
with open(file_path, 'wb') as file_obj:
- file_obj.write(input)
+ file_obj.write(input_s)
ret = end_of_file_fixer([file_path])
file_output = open(file_path, 'rb').read()
diff --git a/tests/requirements_txt_fixer_test.py b/tests/requirements_txt_fixer_test.py
index 49b0bb7..4e5c5c1 100644
--- a/tests/requirements_txt_fixer_test.py
+++ b/tests/requirements_txt_fixer_test.py
@@ -17,12 +17,12 @@
)
-@pytest.mark.parametrize(('input', 'expected_retval', 'output'), TESTS)
-def test_integration(input, expected_retval, output, tmpdir):
+@pytest.mark.parametrize(('input_s', 'expected_retval', 'output'), TESTS)
+def test_integration(input_s, expected_retval, output, tmpdir):
path = os.path.join(tmpdir.strpath, 'file.txt')
with open(path, 'wb') as file_obj:
- file_obj.write(input)
+ file_obj.write(input_s)
assert fix_requirements_txt([path]) == expected_retval
assert open(path, 'rb').read() == output
diff --git a/tests/trailing_whitespace_fixer_test.py b/tests/trailing_whitespace_fixer_test.py
index 1c57b10..bf508c0 100644
--- a/tests/trailing_whitespace_fixer_test.py
+++ b/tests/trailing_whitespace_fixer_test.py
@@ -9,8 +9,8 @@
('foo.py', 'foo \nbar \n'),
('bar.py', 'bar\t\nbaz\t\n'),
):
- with open(filename, 'w') as f:
- f.write(contents) # pragma: no cover (python 2.6 coverage bug)
+ with open(filename, 'w') as file_obj:
+ file_obj.write(contents) # pragma: no cover (26 coverage bug)
ret = fix_trailing_whitespace(['foo.py', 'bar.py'])
assert ret == 1
diff --git a/tests/util_test.py b/tests/util_test.py
deleted file mode 100644
index 28ebe81..0000000
--- a/tests/util_test.py
+++ /dev/null
@@ -1,27 +0,0 @@
-import mock
-import pytest
-import sys
-
-from pre_commit_hooks.util import entry
-
-
-@pytest.fixture
-def entry_func():
- @entry
- def func(argv):
- return argv
-
- return func
-
-
-def test_explicitly_passed_argv_are_passed(entry_func):
- input = object()
- ret = entry_func(input)
- assert ret is input
-
-
-def test_no_arguments_passed_uses_argv(entry_func):
- argv = [1, 2, 3, 4]
- with mock.patch.object(sys, 'argv', argv):
- ret = entry_func()
- assert ret == argv[1:]