~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
8
# pep8 is overdoing it a bit IMO
947 by Andrea Azzarone
* data/apt_check.py, data/package-data-downloader, tests/test_pep8.py:
9
IGNORE_PEP8 = "E265, W503"
888 by Brian Murray
releasing package update-notifier version 3.173
10
IGNORE_FILES = (
11
)
12
13
14
class TestPep8Clean(unittest.TestCase):
15
    """ ensure that the tree is pep8 clean """
16
17
    def test_pep8_clean(self):
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",
29
                         "--ignore={0}".format(IGNORE_PEP8 + ", 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",
34
                         "--ignore={0}".format(IGNORE_PEP8),
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()