-
-
Notifications
You must be signed in to change notification settings - Fork 351
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: James Hewitt <[email protected]>
- Loading branch information
Showing
2 changed files
with
22 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import pycodestyle | ||
import os | ||
import site | ||
|
||
|
||
def test_pep8_conformance(): | ||
"""Test that we conform to PEP-8.""" | ||
style = pycodestyle.StyleGuide(ignore=['E501', 'E402', 'W503', 'E241']) | ||
|
||
site_packages = site.getsitepackages() | ||
|
||
def py_files(): | ||
for dir, dirs, files in os.walk(os.path.abspath('.')): | ||
if dir in site_packages: | ||
dirs.clear() # os.walk lets us modify the dirs list to prune the walk | ||
files.clear() # we also don't want to process files in the root of this excluded dir | ||
for file in files: | ||
if file.endswith('.py'): | ||
yield os.path.join(dir, file) | ||
|
||
result = style.check_files(py_files()) | ||
assert result.total_errors == 0, "Found #{0} code style errors".format(result.total_errors) |