Conditions | 7 |
Total Lines | 26 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | # pyre-strict |
||
17 | def test_strict_all_python_files(self) -> None: |
||
18 | """ |
||
19 | Check that all relevant Python files have Pyre set to strict mode. |
||
20 | """ |
||
21 | for directory, _directories, files in os.walk('.'): |
||
22 | for file in files: |
||
23 | if not file.endswith('.py'): |
||
24 | continue |
||
25 | |||
26 | path = os.path.join(directory, file) |
||
27 | |||
28 | if './lib/' in path: |
||
29 | # Prevent false positive in Scrutinizer. |
||
30 | continue |
||
31 | |||
32 | if './bin/activate_this.py' in path: |
||
33 | # Prevent false positive in Scrutinizer. |
||
34 | continue |
||
35 | |||
36 | with open(path) as current_file: |
||
37 | first_line: str = current_file.readline() |
||
38 | |||
39 | self.assertEqual( |
||
40 | first_line, |
||
41 | '# pyre-strict\n', |
||
42 | path + ' is not set to Pyre strict mode.', |
||
43 | ) |
||
44 |