summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2012-11-10 15:19:09 -0500
committerNed Batchelder <ned@nedbatchelder.com>2012-11-10 15:19:09 -0500
commitf52b43321aad4c8e50bafbfbe95f1e7e570b4b8d (patch)
tree78732b1d1d9a24a84b0424ad5cd355c05c6ca96b
parent5aa66708b1c35fc7ce6e234bfe7684325e327ce4 (diff)
downloadpython-coveragepy-git-f52b43321aad4c8e50bafbfbe95f1e7e570b4b8d.tar.gz
Upgrading pylint means fixing more nits.
-rw-r--r--coverage/bytecode.py1
-rw-r--r--coverage/cmdline.py4
-rw-r--r--coverage/config.py6
-rw-r--r--coverage/control.py2
-rw-r--r--coverage/files.py2
-rw-r--r--coverage/html.py2
-rw-r--r--coverage/phystokens.py2
-rw-r--r--test/backtest.py2
-rw-r--r--test/test_config.py5
-rw-r--r--test/test_html.py2
-rw-r--r--test/test_phystokens.py4
-rw-r--r--test/test_summary.py4
12 files changed, 18 insertions, 18 deletions
diff --git a/coverage/bytecode.py b/coverage/bytecode.py
index 61c311eb..fd5c7da2 100644
--- a/coverage/bytecode.py
+++ b/coverage/bytecode.py
@@ -27,6 +27,7 @@ class ByteCodes(object):
Returns `ByteCode` objects.
"""
+ # pylint: disable=R0924
def __init__(self, code):
self.code = code
self.offset = 0
diff --git a/coverage/cmdline.py b/coverage/cmdline.py
index 9e83e21b..f9b9b093 100644
--- a/coverage/cmdline.py
+++ b/coverage/cmdline.py
@@ -619,8 +619,8 @@ def unshell_list(s):
HELP_TOPICS = {
# -------------------------
-'classic': """\
-Coverage.py version %(__version__)s
+'classic':
+r"""Coverage.py version %(__version__)s
Measure, collect, and report on code coverage in Python programs.
Usage:
diff --git a/coverage/config.py b/coverage/config.py
index 7a6afe4d..7cac4ac0 100644
--- a/coverage/config.py
+++ b/coverage/config.py
@@ -15,10 +15,10 @@ class HandyConfigParser(configparser.ConfigParser):
def read(self, filename):
"""Read a filename as UTF-8 configuration data."""
+ kwargs = {}
if sys.version_info >= (3, 2):
- super().read(filename, encoding="utf-8")
- else:
- configparser.ConfigParser.read(self, filename)
+ kwargs['encoding'] = "utf-8"
+ configparser.ConfigParser.read(self, filename, **kwargs)
def getlist(self, section, option):
"""Read a list of strings.
diff --git a/coverage/control.py b/coverage/control.py
index bda19a9b..9523defa 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -652,7 +652,7 @@ class coverage(object):
('path', sys.path),
('environment', [
("%s = %s" % (k, v)) for k, v in os.environ.items()
- if re.search("^COV|^PY", k)
+ if re.search(r"^COV|^PY", k)
]),
]
return info
diff --git a/coverage/files.py b/coverage/files.py
index 632d6e31..84466504 100644
--- a/coverage/files.py
+++ b/coverage/files.py
@@ -196,7 +196,7 @@ class PathAliases(object):
# either separator.
regex_pat = regex_pat.replace(r"\/", r"[\\/]")
# We want case-insensitive matching, so add that flag.
- regex = re.compile("(?i)" + regex_pat)
+ regex = re.compile(r"(?i)" + regex_pat)
# Normalize the result: it must end with a path separator.
result_sep = sep(result)
diff --git a/coverage/html.py b/coverage/html.py
index fc1bee43..6a6c648e 100644
--- a/coverage/html.py
+++ b/coverage/html.py
@@ -366,5 +366,5 @@ def spaceless(html):
Get rid of some.
"""
- html = re.sub(">\s+<p ", ">\n<p ", html)
+ html = re.sub(r">\s+<p ", ">\n<p ", html)
return html
diff --git a/coverage/phystokens.py b/coverage/phystokens.py
index 3beebab1..166020e1 100644
--- a/coverage/phystokens.py
+++ b/coverage/phystokens.py
@@ -119,7 +119,7 @@ def source_encoding(source):
# This is mostly code adapted from Py3.2's tokenize module.
- cookie_re = re.compile("coding[:=]\s*([-\w.]+)")
+ cookie_re = re.compile(r"coding[:=]\s*([-\w.]+)")
# Do this so the detect_encode code we copied will work.
readline = iter(source.splitlines()).next
diff --git a/test/backtest.py b/test/backtest.py
index c54171d3..b17aa242 100644
--- a/test/backtest.py
+++ b/test/backtest.py
@@ -31,7 +31,7 @@ else:
stderr=subprocess.STDOUT
)
output, _ = proc.communicate()
- status = proc.returncode
+ status = proc.returncode # pylint: disable=E1101
# Get the output, and canonicalize it to strings with newlines.
if not isinstance(output, str):
diff --git a/test/test_config.py b/test/test_config.py
index 5b8714cb..19e37ab9 100644
--- a/test/test_config.py
+++ b/test/test_config.py
@@ -3,7 +3,6 @@
import os, sys
import coverage
-from coverage.backward import to_bytes
from coverage.misc import CoverageException
sys.path.insert(0, os.path.split(__file__)[0]) # Force relative import for Py3k
@@ -162,7 +161,7 @@ class ConfigFileTest(CoverageTest):
self.assertTrue(cov.config.parallel)
self.assertEqual(cov.get_exclude_list(),
- ["if 0:", "pragma:?\s+no cover", "another_tab"]
+ ["if 0:", r"pragma:?\s+no cover", "another_tab"]
)
self.assertTrue(cov.config.ignore_errors)
self.assertEqual(cov.config.include, ["a/", "b/"])
@@ -172,7 +171,7 @@ class ConfigFileTest(CoverageTest):
self.assertEqual(cov.config.precision, 3)
self.assertEqual(cov.config.partial_list,
- ["pragma:?\s+no branch"]
+ [r"pragma:?\s+no branch"]
)
self.assertEqual(cov.config.partial_always_list,
["if 0:", "while True:"]
diff --git a/test/test_html.py b/test/test_html.py
index 2b389c07..5e5f7ce3 100644
--- a/test/test_html.py
+++ b/test/test_html.py
@@ -176,7 +176,7 @@ class HtmlTest(CoverageTest):
if sys.version_info[:2] != (3,1):
def test_non_ascii_title_set_in_config_file(self):
self.create_initial_files()
- self.make_file(".coveragerc",
+ self.make_file(".coveragerc",
"[html]\ntitle = «ταБЬℓσ» numbers"
)
self.run_coverage()
diff --git a/test/test_phystokens.py b/test/test_phystokens.py
index 0e778510..d4e417e8 100644
--- a/test/test_phystokens.py
+++ b/test/test_phystokens.py
@@ -37,8 +37,8 @@ class PhysTokensTest(CoverageTest):
# source_token_lines doesn't preserve trailing spaces, so trim all that
# before comparing.
source = source.replace('\r\n', '\n')
- source = re.sub("(?m)[ \t]+$", "", source)
- tokenized = re.sub("(?m)[ \t]+$", "", tokenized)
+ source = re.sub(r"(?m)[ \t]+$", "", source)
+ tokenized = re.sub(r"(?m)[ \t]+$", "", tokenized)
self.assertMultiLineEqual(source, tokenized)
def check_file_tokenization(self, fname):
diff --git a/test/test_summary.py b/test/test_summary.py
index fd5c1b66..fae91ba5 100644
--- a/test/test_summary.py
+++ b/test/test_summary.py
@@ -142,9 +142,9 @@ class SummaryTest(CoverageTest):
last = self.last_line_squeezed(report)
# The actual file name varies run to run.
- last = re.sub("parse '.*mycode.py", "parse 'mycode.py", last)
+ last = re.sub(r"parse '.*mycode.py", "parse 'mycode.py", last)
# The actual error message varies version to version
- last = re.sub(": '.*' at", ": 'error' at", last)
+ last = re.sub(r": '.*' at", ": 'error' at", last)
self.assertEqual(last,
"mycode NotPython: "
"Couldn't parse 'mycode.py' as Python source: "