diff --git a/test/test.py b/test/test.py index 723c1f23..d4cdd8c7 100644 --- a/test/test.py +++ b/test/test.py @@ -167,6 +167,24 @@ class TestBase(unittest.TestCase): check=False, ) + @staticmethod + def have_autopep8() -> bool: + """Check autopep8 Availability + + This checks whether `autopep8` is available in the current path and + can be called by this process. + """ + + try: + r = subprocess.run( + ["autopep8-3", "--version"], + encoding="utf-8", stdout=subprocess.PIPE, check=False + ) + except FileNotFoundError: + return False + + return r.returncode == 0 and "autopep8" in r.stdout + @staticmethod def have_rpm_ostree() -> bool: """Check rpm-ostree Availability