Fix H404/405 violations for tools
There is a lot of H404/405 violations in Tempest now, and that leads difficult to migrate the code to tempest-lib or the other projects' repos. This patch fixes these violations for tools for enabling H404/405 rules on Tempest. Change-Id: I4e1d78532d8f96edd5fd28a7bd2d62181fe9144b
This commit is contained in:
parent
b279084f73
commit
7616d19360
@ -114,10 +114,8 @@ class TestChecker(object):
|
||||
|
||||
@staticmethod
|
||||
def _get_idempotent_id(test_node):
|
||||
"""
|
||||
Return key-value dict with all metadata from @test.idempotent_id
|
||||
decorators for test method
|
||||
"""
|
||||
# Return key-value dict with all metadata from @test.idempotent_id
|
||||
# decorators for test method
|
||||
idempotent_id = None
|
||||
for decorator in test_node.decorator_list:
|
||||
if (hasattr(decorator, 'func') and
|
||||
@ -264,8 +262,9 @@ class TestChecker(object):
|
||||
return self._filter_tests(check_uuid_in_meta, tests)
|
||||
|
||||
def report_collisions(self, tests):
|
||||
"""Reports collisions if there are any. Returns true if
|
||||
collisions exist.
|
||||
"""Reports collisions if there are any.
|
||||
|
||||
Returns true if collisions exist.
|
||||
"""
|
||||
uuids = {}
|
||||
|
||||
@ -298,8 +297,9 @@ class TestChecker(object):
|
||||
return bool(self._filter_tests(report, tests))
|
||||
|
||||
def report_untagged(self, tests):
|
||||
"""Reports untagged tests if there are any. Returns true if
|
||||
untagged tests exist.
|
||||
"""Reports untagged tests if there are any.
|
||||
|
||||
Returns true if untagged tests exist.
|
||||
"""
|
||||
def report(module_name, test_name, tests):
|
||||
error_str = "%s:%s\nmissing @test.idempotent_id('...')\n%s\n" % (
|
||||
@ -312,9 +312,7 @@ class TestChecker(object):
|
||||
return bool(self._filter_tests(report, tests))
|
||||
|
||||
def fix_tests(self, tests):
|
||||
"""Add uuids to all tests specified in tests and
|
||||
fix it in source files
|
||||
"""
|
||||
"""Add uuids to all tests specified in tests and fix it"""
|
||||
patcher = SourcePatcher()
|
||||
for module_name in tests:
|
||||
add_import_once = True
|
||||
|
@ -50,9 +50,9 @@ import testtools
|
||||
|
||||
|
||||
class _AnsiColorizer(object):
|
||||
"""
|
||||
A colorizer is an object that loosely wraps around a stream, allowing
|
||||
callers to write text to the stream in a particular color.
|
||||
"""A colorizer is an object that loosely wraps around a stream
|
||||
|
||||
allowing callers to write text to the stream in a particular color.
|
||||
|
||||
Colorizer classes must implement C{supported()} and C{write(text, color)}.
|
||||
"""
|
||||
@ -63,7 +63,8 @@ class _AnsiColorizer(object):
|
||||
self.stream = stream
|
||||
|
||||
def supported(cls, stream=sys.stdout):
|
||||
"""
|
||||
"""Check the current platform supports coloring terminal output
|
||||
|
||||
A class method that returns True if the current platform supports
|
||||
coloring terminal output using this method. Returns False otherwise.
|
||||
"""
|
||||
@ -86,8 +87,7 @@ class _AnsiColorizer(object):
|
||||
supported = classmethod(supported)
|
||||
|
||||
def write(self, text, color):
|
||||
"""
|
||||
Write the given text to the stream in the given color.
|
||||
"""Write the given text to the stream in the given color.
|
||||
|
||||
@param text: Text to be written to the stream.
|
||||
|
||||
@ -98,9 +98,7 @@ class _AnsiColorizer(object):
|
||||
|
||||
|
||||
class _Win32Colorizer(object):
|
||||
"""
|
||||
See _AnsiColorizer docstring.
|
||||
"""
|
||||
"""See _AnsiColorizer docstring."""
|
||||
def __init__(self, stream):
|
||||
import win32console
|
||||
red, green, blue, bold = (win32console.FOREGROUND_RED,
|
||||
@ -146,9 +144,7 @@ class _Win32Colorizer(object):
|
||||
|
||||
|
||||
class _NullColorizer(object):
|
||||
"""
|
||||
See _AnsiColorizer docstring.
|
||||
"""
|
||||
"""See _AnsiColorizer docstring."""
|
||||
def __init__(self, stream):
|
||||
self.stream = stream
|
||||
|
||||
|
@ -40,7 +40,8 @@ def debug(msg, *args, **kwargs):
|
||||
|
||||
|
||||
def find_skips(start=TESTDIR):
|
||||
"""
|
||||
"""Find skipped tests
|
||||
|
||||
Returns a list of tuples (method, bug) that represent
|
||||
test methods that have been decorated to skip because of
|
||||
a particular bug.
|
||||
@ -67,9 +68,7 @@ def find_skips(start=TESTDIR):
|
||||
|
||||
|
||||
def find_skips_in_file(path):
|
||||
"""
|
||||
Return the skip tuples in a test file
|
||||
"""
|
||||
"""Return the skip tuples in a test file"""
|
||||
BUG_RE = re.compile(r'\s*@.*skip_because\(bug=[\'"](\d+)[\'"]')
|
||||
DEF_RE = re.compile(r'\s*def (\w+)\(')
|
||||
bug_found = False
|
||||
|
Loading…
Reference in New Issue
Block a user