From cae23de6055250cf8ed97dcbb63b568744fb1b2b Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Thu, 4 Aug 2022 16:53:15 +0200 Subject: [PATCH] test/pylint: add autopep8 test Add a test to ensure our source code is PEP-8 compliant. --- test/src/test_pylint.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/src/test_pylint.py b/test/src/test_pylint.py index f6938bc2..8542b037 100644 --- a/test/src/test_pylint.py +++ b/test/src/test_pylint.py @@ -53,3 +53,10 @@ def test_pylint(source_files): # subprocess.run(["pylint"] + source_files, check=True) + + +@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) + if r.returncode != 0: + pytest.fail("autopep8 has detected changes (see diff)")