commit 611ecdbcaea03d28564dcce5129366e9e90d4813 Author: Damian Johnson atagar@torproject.org Date: Mon Sep 1 20:41:05 2014 -0700
Dropping get_* prefix from testing functions --- run_tests.py | 4 ++-- stem/util/test_tools.py | 25 ++++++++++++++++++++----- 2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/run_tests.py b/run_tests.py index 2d73457..2a541cf 100755 --- a/run_tests.py +++ b/run_tests.py @@ -91,7 +91,7 @@ https://pypi.python.org/pypi/mock/
PYFLAKES_TASK = Task( "running pyflakes", - stem.util.test_tools.get_pyflakes_issues, + stem.util.test_tools.pyflakes_issues, args = (SRC_PATHS,), is_required = False, print_result = False, @@ -99,7 +99,7 @@ PYFLAKES_TASK = Task(
PEP8_TASK = Task( "running pep8", - stem.util.test_tools.get_stylistic_issues, + stem.util.test_tools.stylistic_issues, args = (SRC_PATHS, True, True, True, True), is_required = False, print_result = False, diff --git a/stem/util/test_tools.py b/stem/util/test_tools.py index ba6392d..8209c58 100644 --- a/stem/util/test_tools.py +++ b/stem/util/test_tools.py @@ -13,8 +13,8 @@ Helper functions for testing. is_pyflakes_available - checks if pyflakes is available is_pep8_available - checks if pep8 is available
- get_stylistic_issues - checks for PEP8 and other stylistic issues - get_pyflakes_issues - static checks for problems via pyflakes + stylistic_issues - checks for PEP8 and other stylistic issues + pyflakes_issues - static checks for problems via pyflakes """
import os @@ -103,7 +103,7 @@ def is_pep8_available(): return False
-def get_stylistic_issues(paths, check_two_space_indents = False, check_newlines = False, check_trailing_whitespace = False, check_exception_keyword = False): +def stylistic_issues(paths, check_two_space_indents = False, check_newlines = False, check_trailing_whitespace = False, check_exception_keyword = False): """ Checks for stylistic issues that are an issue according to the parts of PEP8 we conform to. You can suppress PEP8 issues by making a 'test' configuration @@ -131,11 +131,15 @@ def get_stylistic_issues(paths, check_two_space_indents = False, check_newlines test_config = stem.util.conf.get_config('test') test_config.load('test/settings.cfg')
- issues = get_stylistic_issues('my_project') + issues = stylistic_issues('my_project')
If a 'exclude_paths' was set in our test config then we exclude any absolute paths matching those regexes.
+ .. versionchanged:: 1.3.0 + Renamed from get_stylistic_issues() to stylistic_issues(). The old name + still works as an alias, but will be dropped in Stem version 2.0.0. + :param list paths: paths to search for stylistic issues :param bool check_two_space_indents: check for two space indentations and that no tabs snuck in @@ -209,7 +213,7 @@ def get_stylistic_issues(paths, check_two_space_indents = False, check_newlines return issues
-def get_pyflakes_issues(paths): +def pyflakes_issues(paths): """ Performs static checks via pyflakes. False positives can be ignored via 'pyflakes.ignore' entries in our 'test' config. For instance... @@ -222,6 +226,10 @@ def get_pyflakes_issues(paths): If a 'exclude_paths' was set in our test config then we exclude any absolute paths matching those regexes.
+ .. versionchanged:: 1.3.0 + Renamed from get_pyflakes_issues() to pyflakes_issues(). The old name + still works as an alias, but will be dropped in Stem version 2.0.0. + :param list paths: paths to search for problems
:returns: dict of the form ``path => [(line_number, message)...]`` @@ -284,3 +292,10 @@ def _python_files(paths):
if not skip: yield file_path + +# TODO: drop with stem 2.x +# We renamed our methods to drop a redundant 'get_*' prefix, so alias the old +# names for backward compatability. + +get_stylistic_issues = stylistic_issues +get_pyflakes_issues = pyflakes_issues