~ubuntu-core-dev/update-notifier/ubuntu

888 by Brian Murray
releasing package update-notifier version 3.173
1
#!/usr/bin/python3
2
# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
3
4
import os
5
import subprocess
6
import unittest
7
983 by dann frazier
Search and replace pep8 w/ pycodestyle after rename.
8
# pycodestyle is overdoing it a bit IMO
9
IGNORE_PYCODESTYLE = "E265, W503"
888 by Brian Murray
releasing package update-notifier version 3.173
10
IGNORE_FILES = (
11
)
12
13
983 by dann frazier
Search and replace pep8 w/ pycodestyle after rename.
14
class TestPyCodeStyleClean(unittest.TestCase):
15
    """ ensure that the tree is pycodestyle clean """
888 by Brian Murray
releasing package update-notifier version 3.173
16
983 by dann frazier
Search and replace pep8 w/ pycodestyle after rename.
17
    def test_pycodestyle_clean(self):
888 by Brian Murray
releasing package update-notifier version 3.173
18
        CURDIR = os.path.dirname(os.path.abspath(__file__))
19
        for dirpath, dirs, files in os.walk(os.path.join(CURDIR, "..")):
20
            for f in files:
21
                if os.path.splitext(f)[1] != ".py":
22
                    continue
23
                if f in IGNORE_FILES:
24
                    continue
975 by Brian Murray
data/apt_check.py: modify wording and output regarding ESM support.
25
                py_file = os.path.join(dirpath, f)
26
                if f == 'test_motd.py':
27
                    ret_code = subprocess.call(
981 by Julian Andres Klode
Replace pep8 with pycodestyle
28
                        ["pycodestyle",
983 by dann frazier
Search and replace pep8 w/ pycodestyle after rename.
29
                         "--ignore={0}".format(IGNORE_PYCODESTYLE + ", E501"),
975 by Brian Murray
data/apt_check.py: modify wording and output regarding ESM support.
30
                         py_file])
31
                else:
32
                    ret_code = subprocess.call(
981 by Julian Andres Klode
Replace pep8 with pycodestyle
33
                        ["pycodestyle",
983 by dann frazier
Search and replace pep8 w/ pycodestyle after rename.
34
                         "--ignore={0}".format(IGNORE_PYCODESTYLE),
981 by Julian Andres Klode
Replace pep8 with pycodestyle
35
                         py_file])
975 by Brian Murray
data/apt_check.py: modify wording and output regarding ESM support.
36
                self.assertEqual(0, ret_code)
888 by Brian Murray
releasing package update-notifier version 3.173
37
38
39
if __name__ == "__main__":
40
    import logging
41
    logging.basicConfig(level=logging.DEBUG)
42
    unittest.main()