1 # -*- coding: utf-8 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from pprint
import pprint
8 from textwrap
import dedent
16 def test_lint_fix(lint
, create_temp_file
):
24 path
= create_temp_file(contents
, "bad.py")
25 lint([path
], fix
=True)
29 def test_lint_fix_warning(lint
, create_temp_file
):
41 path
= create_temp_file(contents
, "bad.py")
42 lint([path
], warning
=True, fix
=True)
46 def test_lint_fix_withotu_warning(lint
, create_temp_file
):
58 path
= create_temp_file(contents
, "bad.py")
59 lint([path
], warning
=False, fix
=True)
63 def test_lint_ruff(lint
, paths
):
64 results
= lint(paths())
65 pprint(results
, indent
=2)
66 assert len(results
) == 2
67 assert results
[0].level
== "error"
68 assert results
[0].relpath
== "bad.py"
69 assert "`distutils` imported but unused" in results
[0].message
72 if __name__
== "__main__":