mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-11 05:44:16 +00:00
Simplify the tests
This commit is contained in:
parent
b64436cdda
commit
a99475afa0
14 changed files with 144 additions and 201 deletions
|
|
@ -1,5 +1,3 @@
|
|||
import os.path
|
||||
|
||||
import pytest
|
||||
|
||||
from pre_commit_hooks.requirements_txt_fixer import fix_requirements_txt
|
||||
|
|
@ -22,13 +20,11 @@ TESTS = (
|
|||
|
||||
@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')
|
||||
path = tmpdir.join('file.txt')
|
||||
path.write_binary(input_s)
|
||||
|
||||
with open(path, 'wb') as file_obj:
|
||||
file_obj.write(input_s)
|
||||
|
||||
assert fix_requirements_txt([path]) == expected_retval
|
||||
assert open(path, 'rb').read() == output
|
||||
assert fix_requirements_txt([path.strpath]) == expected_retval
|
||||
assert path.read_binary() == output
|
||||
|
||||
|
||||
def test_requirement_object():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue