Run mypy over the codebase.
(self)
| 82 | 'Found pycodestyle warnings or errors.') |
| 83 | |
| 84 | def test_mypy(self): |
| 85 | ''' |
| 86 | Run mypy over the codebase. |
| 87 | ''' |
| 88 | # pylint: disable=c-extension-no-member |
| 89 | result = mypy.api.run(['./Test']) |
| 90 | |
| 91 | # Write the mypy log |
| 92 | if result[0]: |
| 93 | with open('mypy.log', 'w', encoding='utf-8') as handle: |
| 94 | handle.write(result[0]) |
| 95 | |
| 96 | # Extract actual result lines from the log |
| 97 | lines = result[0].splitlines() |
| 98 | error_lines = [] |
| 99 | for line in lines: |
| 100 | # Skip lines that are just status |
| 101 | if line.startswith('Success'): |
| 102 | continue |
| 103 | if line.startswith('Found'): |
| 104 | continue |
| 105 | |
| 106 | error_lines.append(line) |
| 107 | |
| 108 | self.assertEqual(len(error_lines), 0, |
| 109 | 'Found mypy warnings or errors.') |
| 110 | |
| 111 | self.assertFalse(bool(result[1]), |
| 112 | 'mypy failed to run.') |
| 113 | |
| 114 | |
| 115 | def main(): |
nothing calls this directly
no outgoing calls
no test coverage detected