mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-04 20:26:53 +00:00
Remove unnecessary and outdated test runner
This commit is contained in:
parent
3da9fd3cb7
commit
48b995fa62
3 changed files with 22 additions and 45 deletions
|
|
@ -1,26 +1,33 @@
|
|||
"""Tests for the FileChecker class."""
|
||||
from flake8 import checker
|
||||
"""Tests for the FileProcessor class."""
|
||||
import optparse
|
||||
|
||||
from flake8 import processor
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def options_from(**kwargs):
|
||||
kwargs.setdefault('hang_closing', True)
|
||||
kwargs.setdefault('max_line_length', 79)
|
||||
kwargs.setdefault('verbose', False)
|
||||
return optparse.Values(kwargs)
|
||||
|
||||
|
||||
def test_read_lines_splits_lines():
|
||||
"""Verify that read_lines splits the lines of the file."""
|
||||
file_checker = checker.FileChecker(__file__, [])
|
||||
lines = file_checker.read_lines()
|
||||
file_processor = processor.FileProcessor(__file__, options_from())
|
||||
lines = file_processor.lines
|
||||
assert len(lines) > 5
|
||||
assert '"""Tests for the FileChecker class."""\n' in lines
|
||||
assert '"""Tests for the FileProcessor class."""\n' in lines
|
||||
|
||||
|
||||
@pytest.mark.parametrize('first_line', [
|
||||
'\xEF\xBB\xBF"""Module docstring."""\n',
|
||||
'\uFEFF"""Module docstring."""\n',
|
||||
u'\uFEFF"""Module docstring."""\n',
|
||||
])
|
||||
def test_strip_utf_bom(first_line):
|
||||
r"""Verify that we strip '\xEF\xBB\xBF' from the first line."""
|
||||
lines = [first_line]
|
||||
file_checker = checker.FileChecker('stdin', [])
|
||||
file_checker.lines = lines[:]
|
||||
file_checker.strip_utf_bom()
|
||||
assert file_checker.lines != lines
|
||||
assert file_checker.lines[0] == '"""Module docstring."""\n'
|
||||
file_processor = processor.FileProcessor('-', options_from(), lines[:])
|
||||
assert file_processor.lines != lines
|
||||
assert file_processor.lines[0] == '"""Module docstring."""\n'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue