diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 00000000..619db632 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1 @@ +1be3f1bfb671fa6d59dcd2203f23e1625194574b diff --git a/test/src/test_pylint.py b/test/src/test_pylint.py index 5dc0ede9..103224c0 100644 --- a/test/src/test_pylint.py +++ b/test/src/test_pylint.py @@ -68,6 +68,19 @@ def test_mypy(): pytest.fail("mypy issues detected") +@pytest.mark.skipif(not test.TestBase.have_isort(), reason="isort not available") +def test_isort(source_files): + # + # Run `isort` on all python sources. We simply use `find` to locate + # all `*.py` files, and then manually select the reverse-domain named + # modules we have. + # + + r = subprocess.run(["isort", "-c"] + source_files, check=False) + if r.returncode != 0: + pytest.fail("isort issues detected") + + @pytest.mark.skipif(not test.TestBase.have_autopep8(), reason="autopep8 not available") def test_autopep8(source_files): r = subprocess.run(["autopep8-3", "--diff", "--exit-code"] + source_files, check=False) diff --git a/test/test.py b/test/test.py index f3fa22c1..781d7754 100644 --- a/test/test.py +++ b/test/test.py @@ -203,6 +203,23 @@ class TestBase(unittest.TestCase): return r.returncode == 0 and "mypy" in r.stdout + def have_isort() -> bool: + """Check isort Availability + + This checks whether `isort` is available in the current path and + can be called by this process. + """ + + try: + r = subprocess.run( + ["isort", "--version"], + encoding="utf-8", stdout=subprocess.PIPE, check=False + ) + except FileNotFoundError: + return False + + return r.returncode == 0 and "isort" in r.stdout + @staticmethod def have_rpm_ostree() -> bool: """Check rpm-ostree Availability