test: integrate pylint into the test infrastructure
Introduce a third test-group called `src` alongside `mod` and `run. This will contain tests that run against the source code of osbuild. This initial commit introduces `test/src/test_pylint.py` which will run the python linter against all our sources.
This commit is contained in:
parent
b830bb7480
commit
082b840d94
4 changed files with 44 additions and 11 deletions
0
test/src/__init__.py
Normal file
0
test/src/__init__.py
Normal file
30
test/src/test_pylint.py
Normal file
30
test/src/test_pylint.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#
|
||||
# Run `pylint` on all python sources.
|
||||
#
|
||||
|
||||
import subprocess
|
||||
import unittest
|
||||
|
||||
from .. import test
|
||||
|
||||
|
||||
@unittest.skipUnless(test.TestBase.have_test_checkout(), "no test-checkout access")
|
||||
class TestPylint(test.TestBase, unittest.TestCase):
|
||||
def test_pylint(self):
|
||||
#
|
||||
# Run `pylint` on all python sources. We simply use `find` to locate
|
||||
# all `*.py` files, and then manually select the reverse-domain named
|
||||
# modules we have.
|
||||
#
|
||||
|
||||
path = self.locate_test_checkout()
|
||||
options = "--errors-only"
|
||||
|
||||
subprocess.run(f"find {path} -type f -name '*.py' | xargs pylint {options}",
|
||||
shell=True, check=True)
|
||||
subprocess.run(f"pylint {options}"
|
||||
+ f" {path}/assemblers/*"
|
||||
+ f" {path}/runners/*"
|
||||
+ f" {path}/sources/*"
|
||||
+ f" {path}/stages/*",
|
||||
shell=True, check=True)
|
||||
Loading…
Add table
Add a link
Reference in a new issue