test: add have_autopep8 method
Add a helper to check if the `autopep8` command is available.
This commit is contained in:
parent
620f7c0f3e
commit
bb644cdd07
1 changed files with 18 additions and 0 deletions
18
test/test.py
18
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue