~ubuntu-core-dev/update-manager/main

« back to all changes in this revision

Viewing changes to tests/test_pyflakes.py

  • Committer: Benjamin Drung
  • Date: 2023-02-13 12:45:23 UTC
  • Revision ID: benjamin.drung@canonical.com-20230213124523-4f1nv2fyvsdl35jb
Fix pycodestyle complains by formatting Python code with black

```
black -C -l 79 .
```

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
 
17
17
class TestPyflakesClean(unittest.TestCase):
18
 
    """ ensure that the tree is pyflakes clean """
 
18
    """ensure that the tree is pyflakes clean"""
19
19
 
20
20
    def read_exclusions(self):
21
21
        exclusions = {}
35
35
            if line.startswith("#"):
36
36
                continue
37
37
 
38
 
            line = line.rstrip().split(CURDIR + '/', 1)[1]
 
38
            line = line.rstrip().split(CURDIR + "/", 1)[1]
39
39
            test_line = re.sub(r":[0-9]+:", r":*:", line, 1)
40
40
            test_line = re.sub(r"line [0-9]+", r"line *", test_line)
41
41
 
47
47
        #      that are symlinks to other packages
48
48
        cmd = 'find %s/.. -type f -name "*.py" | xargs pyflakes3' % CURDIR
49
49
        p = subprocess.Popen(
50
 
            cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
51
 
            close_fds=True, shell=True, universal_newlines=True)
 
50
            cmd,
 
51
            stdout=subprocess.PIPE,
 
52
            stderr=subprocess.PIPE,
 
53
            close_fds=True,
 
54
            shell=True,
 
55
            universal_newlines=True,
 
56
        )
52
57
        contents = p.communicate()[0].splitlines()
53
58
        filtered_contents = list(self.filter_exclusions(contents))
54
59
        for line in filtered_contents:
58
63
 
59
64
if __name__ == "__main__":
60
65
    import logging
 
66
 
61
67
    logging.basicConfig(level=logging.DEBUG)
62
68
    unittest.main()