コード例 #1
0
ファイル: test_flake8.py プロジェクト: jayvdb/ebb-lint-1
def scan_for_checkers(request):
    parser, options_hooks = get_parser()
    args_marker = request.node.get_closest_marker('flake8_args')
    if args_marker is None:
        args = []
    else:
        args = list(args_marker.args)
    opts, args = parser.parse_args(args)
    opts.ignore = tuple(opts.ignore)
    EbbLint.parse_options(opts)
コード例 #2
0
ファイル: test_flake8.py プロジェクト: flowroute/ebb-lint
def scan_for_checkers(request):
    parser, options_hooks = get_parser()
    args_marker = request.node.get_marker("flake8_args")
    if args_marker is None:
        args = []
    else:
        args = list(args_marker.args)
    opts, args = parser.parse_args(args)
    opts.ignore = tuple(opts.ignore)
    EbbLint.parse_options(opts)
コード例 #3
0
ファイル: test_flake8.py プロジェクト: jayvdb/ebb-lint
 def check(source, sourcefile, no_errors=False):
     # Strip trailing spaces, since the most comfortable triple-quoted
     # string format will have extra spaces on the last line. If this isn't
     # removed, it'll throw off the trailing newline checker.
     source = source.rstrip(' ')
     source, error_locations = find_error_locations(source)
     if no_errors:
         error_locations = []
     sourcefile.write_text(source, encoding='utf-8')
     lint = EbbLint(ast.parse(source), sourcefile.strpath)
     actual = [
         (line, col, message[:4]) for line, col, message, _ in lint.run()]
     assert actual == error_locations
コード例 #4
0
ファイル: test_flake8.py プロジェクト: flowroute/ebb-lint
def assert_ebb_lint(source_text, source_path, error_locations):
    lint = EbbLint(ast.parse(source_text), source_path)
    return [(line, col, message[:4]) for line, col, message, _ in lint.run()]
コード例 #5
0
ファイル: test_flake8.py プロジェクト: jayvdb/ebb-lint-1
 def get_parser():
     parser = manager.OptionManager(prog='ebb_lint_test', version='1')
     options.register_default_options(parser)
     EbbLint.add_options(parser)
     return parser, None
コード例 #6
0
ファイル: test_flake8.py プロジェクト: jayvdb/ebb-lint-1
def assert_ebb_lint(source_text, source_path, error_locations):
    lint = EbbLint(ast.parse(source_text), source_path)
    actual = {
        (line, col, message[:4]) for line, col, message, _ in lint.run()}
    assert actual == set(error_locations)
コード例 #7
0
def assert_ebb_lint(source_text, source_path, error_locations):
    lint = EbbLint(ast.parse(source_text), source_path)
    return [(line, col, message[:4]) for line, col, message, _ in lint.run()]