Skip to content

check-only false positive if file is missing closing newline #676

@mattbennett

Description

@mattbennett

isort --check-only will complain about import whitespace if the file is missing a closing newline.

def test_strict_whitespace_no_newline(capsys):
    test_input = ('import os\n'
                  '\n'
                  'from django.conf import settings\n'
                  '\n'
                  'print(1)')
    SortImports(file_contents=test_input, check=True)
    out, err = capsys.readouterr()
    assert out == ''  # valid imports, but AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions