summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-01-07 12:06:11 -0500
committerNed Batchelder <ned@nedbatchelder.com>2016-01-07 12:06:11 -0500
commit152dd7d6e4b9a53e89cb7ec0cacf0f01be4abc73 (patch)
tree7afcc1a641b7dfad81367f585e4d862df732271d
parent1a57255a7fe11f6a4318b728dfa90131c97b7eee (diff)
downloadpython-coveragepy-git-152dd7d6e4b9a53e89cb7ec0cacf0f01be4abc73.tar.gz
Clean up small stuff
--HG-- branch : ast-branch
-rw-r--r--coverage/parser.py9
-rw-r--r--coverage/python.py4
-rw-r--r--pylintrc6
-rw-r--r--tests/test_arcs.py2
4 files changed, 16 insertions, 5 deletions
diff --git a/coverage/parser.py b/coverage/parser.py
index 16419ca4..c03a3083 100644
--- a/coverage/parser.py
+++ b/coverage/parser.py
@@ -253,6 +253,12 @@ class PythonParser(object):
self.statements = self.first_lines(starts) - ignore
def arcs(self):
+ """Get information about the arcs available in the code.
+
+ Returns a set of line number pairs. Line numbers have been normalized
+ to the first line of multi-line statements.
+
+ """
if self._all_arcs is None:
aaa = AstArcAnalyzer(self.text, self.raw_funcdefs, self.raw_classdefs)
arcs = aaa.collect_arcs()
@@ -298,10 +304,12 @@ class LoopBlock(object):
self.start = start
self.break_exits = set()
+
class FunctionBlock(object):
def __init__(self, start):
self.start = start
+
class TryBlock(object):
def __init__(self, handler_start=None, final_start=None):
self.handler_start = handler_start # TODO: is this used?
@@ -803,6 +811,7 @@ def is_simple_value(value):
isinstance(value, (string_class, int, float))
)
+# TODO: a test of ast_dump?
def ast_dump(node, depth=0):
indent = " " * depth
if not isinstance(node, ast.AST):
diff --git a/coverage/python.py b/coverage/python.py
index bf19cb22..5e563828 100644
--- a/coverage/python.py
+++ b/coverage/python.py
@@ -160,10 +160,6 @@ class PythonFileReporter(FileReporter):
return self.parser.arcs()
@expensive
- def ast_arcs(self):
- return self.parser.ast_arcs()
-
- @expensive
def exit_counts(self):
return self.parser.exit_counts()
diff --git a/pylintrc b/pylintrc
index 09ac1416..4dc9c8e1 100644
--- a/pylintrc
+++ b/pylintrc
@@ -134,7 +134,11 @@ required-attributes=
# Regular expression which should only match functions or classes name which do
# not require a docstring
-no-docstring-rgx=__.*__|test[A-Z_].*|setUp|tearDown
+# Special methods don't: __foo__
+# Test methods don't: testXXXX
+# TestCase overrides don't: setUp, tearDown
+# Dispatched methods don't: _xxx__Xxxx
+no-docstring-rgx=__.*__|test[A-Z_].*|setUp|tearDown|_.*__.*
# Regular expression which should only match correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index b7976889..28c1df72 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -1032,6 +1032,8 @@ class DecoractorArcTest(CoverageTest):
class AsyncTest(CoverageTest):
+ """Tests of the new async and await keywords in Python 3.5"""
+
def setUp(self):
if env.PYVERSION < (3, 5):
self.skip("Async features are new in Python 3.5")