test/pylint: extract source files into fixture
Extract the code that discovers the source files into a fixture; this is done so that we can share that other future tests.
This commit is contained in:
parent
bf2789fd91
commit
620f7c0f3e
1 changed files with 15 additions and 9 deletions
|
|
@ -10,13 +10,10 @@ import pytest
|
||||||
from .. import test
|
from .. import test
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(not test.TestBase.have_test_checkout(), "no test-checkout access")
|
@pytest.fixture(name="source_files")
|
||||||
def test_pylint():
|
def discover_source_files():
|
||||||
#
|
if not test.TestBase.have_test_checkout():
|
||||||
# Run `pylint` on all python sources. We simply use `find` to locate
|
pytest.skip("no test-checkout access")
|
||||||
# all `*.py` files, and then manually select the reverse-domain named
|
|
||||||
# modules we have.
|
|
||||||
#
|
|
||||||
|
|
||||||
checkout = test.TestBase.locate_test_checkout()
|
checkout = test.TestBase.locate_test_checkout()
|
||||||
|
|
||||||
|
|
@ -45,5 +42,14 @@ def test_pylint():
|
||||||
# Append the checkout-path so all paths are absolute.
|
# Append the checkout-path so all paths are absolute.
|
||||||
files = map(lambda p: os.path.join(checkout, p), files)
|
files = map(lambda p: os.path.join(checkout, p), files)
|
||||||
|
|
||||||
# Run pylint on all files.
|
return list(files)
|
||||||
subprocess.run(["pylint"] + list(files), check=True)
|
|
||||||
|
|
||||||
|
def test_pylint(source_files):
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
subprocess.run(["pylint"] + source_files, check=True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue