summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/backtest.py5
-rw-r--r--tests/conftest.py1
-rw-r--r--tests/coveragetest.py8
-rw-r--r--tests/test_api.py6
-rw-r--r--tests/test_context.py2
-rw-r--r--tests/test_filereporter.py2
-rw-r--r--tests/test_misc.py8
-rw-r--r--tests/test_process.py2
-rw-r--r--tests/test_summary.py14
-rw-r--r--tests/test_templite.py2
10 files changed, 22 insertions, 28 deletions
diff --git a/tests/backtest.py b/tests/backtest.py
index 979f6755..05681dc7 100644
--- a/tests/backtest.py
+++ b/tests/backtest.py
@@ -3,11 +3,6 @@
"""Add things to old Pythons so I can pretend they are newer, for tests."""
-# pylint: disable=redefined-builtin
-# (Redefining built-in blah)
-# The whole point of this file is to redefine built-ins, so shut up about it.
-
-
# No more execfile in Py3
try:
execfile = execfile
diff --git a/tests/conftest.py b/tests/conftest.py
index 8f9053cd..3c6672dc 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -42,7 +42,6 @@ def set_warnings():
)
if env.PYPY and env.PY3:
# pypy3 warns about unclosed files a lot.
- # pylint: disable=undefined-variable
warnings.filterwarnings("ignore", r".*unclosed file", category=ResourceWarning)
diff --git a/tests/coveragetest.py b/tests/coveragetest.py
index ddade452..322f6c72 100644
--- a/tests/coveragetest.py
+++ b/tests/coveragetest.py
@@ -52,12 +52,12 @@ def convert_skip_exceptions(method):
class SkipConvertingMetaclass(type):
"""Decorate all test methods to convert StopEverything to SkipTest."""
- def __new__(mcs, name, bases, attrs):
+ def __new__(cls, name, bases, attrs):
for attr_name, attr_value in attrs.items():
if attr_name.startswith('test_') and isinstance(attr_value, types.FunctionType):
attrs[attr_name] = convert_skip_exceptions(attr_value)
- return super(SkipConvertingMetaclass, mcs).__new__(mcs, name, bases, attrs)
+ return super(SkipConvertingMetaclass, cls).__new__(cls, name, bases, attrs)
CoverageTestMethodsMixin = SkipConvertingMetaclass('CoverageTestMethodsMixin', (), {})
@@ -88,7 +88,7 @@ class CoverageTest(
# Keep the temp directories if the env says to.
# $set_env.py: COVERAGE_KEEP_TMP - Keep the temp directories made by tests.
- keep_temp_dir = bool(int(os.getenv("COVERAGE_KEEP_TMP", 0)))
+ keep_temp_dir = bool(int(os.getenv("COVERAGE_KEEP_TMP", "0")))
def setUp(self):
super(CoverageTest, self).setUp()
@@ -314,7 +314,7 @@ class CoverageTest(
try:
yield
- except:
+ except: # pylint: disable=try-except-raise
raise
else:
if warnings:
diff --git a/tests/test_api.py b/tests/test_api.py
index 51e8c048..107617ea 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -707,7 +707,7 @@ class SourceOmitIncludeTest(OmitIncludeTestsMixin, CoverageTest):
"""
cov = coverage.Coverage(**kwargs)
cov.start()
- import usepkgs # pragma: nested # pylint: disable=import-error, unused-variable
+ import usepkgs # pragma: nested # pylint: disable=import-error, unused-import
cov.stop() # pragma: nested
data = cov.get_data()
summary = line_counts(data)
@@ -769,7 +769,7 @@ class ReportIncludeOmitTest(OmitIncludeTestsMixin, CoverageTest):
"""Try coverage.report()."""
cov = coverage.Coverage()
cov.start()
- import usepkgs # pragma: nested # pylint: disable=import-error, unused-variable
+ import usepkgs # pragma: nested # pylint: disable=import-error, unused-import
cov.stop() # pragma: nested
report = StringIO()
cov.report(file=report, **kwargs)
@@ -788,7 +788,7 @@ class XmlIncludeOmitTest(OmitIncludeTestsMixin, CoverageTest):
"""Try coverage.xml_report()."""
cov = coverage.Coverage()
cov.start()
- import usepkgs # pragma: nested # pylint: disable=import-error, unused-variable
+ import usepkgs # pragma: nested # pylint: disable=import-error, unused-import
cov.stop() # pragma: nested
cov.xml_report(outfile="-", **kwargs)
return self.stdout()
diff --git a/tests/test_context.py b/tests/test_context.py
index bebd9687..29839c57 100644
--- a/tests/test_context.py
+++ b/tests/test_context.py
@@ -229,7 +229,7 @@ def fake_out(self):
def patch_meth(self):
return get_qualname()
-class OldStyle: # pylint: disable=old-style-class
+class OldStyle:
def meth(self):
return get_qualname()
diff --git a/tests/test_filereporter.py b/tests/test_filereporter.py
index e50a7493..eb1e91e8 100644
--- a/tests/test_filereporter.py
+++ b/tests/test_filereporter.py
@@ -81,7 +81,7 @@ class FileReporterTest(UsingModulesMixin, CoverageTest):
acu2 = FileReporter("aa/afile.py")
zcu = FileReporter("aa/zfile.py")
bcu = FileReporter("aa/bb/bfile.py")
- assert acu == acu2 and acu <= acu2 and acu >= acu2
+ assert acu == acu2 and acu <= acu2 and acu >= acu2 # pylint: disable=chained-comparison
assert acu < zcu and acu <= zcu and acu != zcu
assert zcu > acu and zcu >= acu and zcu != acu
assert acu < bcu and acu <= bcu and acu != bcu
diff --git a/tests/test_misc.py b/tests/test_misc.py
index e288c4f2..bde35b66 100644
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -83,7 +83,7 @@ class ContractTest(CoverageTest):
def test_bytes(self):
@contract(text='bytes|None')
- def need_bytes(text=None): # pylint: disable=missing-docstring
+ def need_bytes(text=None):
return text
assert need_bytes(b"Hey") == b"Hey"
@@ -93,7 +93,7 @@ class ContractTest(CoverageTest):
def test_unicode(self):
@contract(text='unicode|None')
- def need_unicode(text=None): # pylint: disable=missing-docstring
+ def need_unicode(text=None):
return text
assert need_unicode(u"Hey") == u"Hey"
@@ -103,7 +103,7 @@ class ContractTest(CoverageTest):
def test_one_of(self):
@one_of("a, b, c")
- def give_me_one(a=None, b=None, c=None): # pylint: disable=missing-docstring
+ def give_me_one(a=None, b=None, c=None):
return (a, b, c)
assert give_me_one(a=17) == (17, None, None)
@@ -116,7 +116,7 @@ class ContractTest(CoverageTest):
def test_dummy_decorator_with_args(self):
@dummy_decorator_with_args("anything", this=17, that="is fine")
- def undecorated(a=None, b=None): # pylint: disable=missing-docstring
+ def undecorated(a=None, b=None):
return (a, b)
assert undecorated() == (None, None)
diff --git a/tests/test_process.py b/tests/test_process.py
index 6d8133cd..0979cc2c 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -1378,7 +1378,7 @@ class ProcessStartupTest(ProcessCoverageMixin, CoverageTest):
data_file = .mycovdata
""")
self.set_environ("COVERAGE_PROCESS_START", "coverage.ini")
- import main # pylint: disable=import-error, unused-variable
+ import main # pylint: disable=unused-import
with open("out.txt") as f:
self.assertEqual(f.read(), "Hello, world!\n")
diff --git a/tests/test_summary.py b/tests/test_summary.py
index 8dd56e64..eed77dba 100644
--- a/tests/test_summary.py
+++ b/tests/test_summary.py
@@ -616,7 +616,7 @@ class SummaryTest(UsingModulesMixin, CoverageTest):
""")
cov = coverage.Coverage(branch=True, source=["."])
cov.start()
- import main # pragma: nested # pylint: disable=import-error, unused-variable
+ import main # pragma: nested # pylint: disable=unused-import
cov.stop() # pragma: nested
report = self.get_report(cov).splitlines()
self.assertIn("mybranch.py 5 5 2 0 0%", report)
@@ -625,7 +625,7 @@ class SummaryTest(UsingModulesMixin, CoverageTest):
"""A helper for the next few tests."""
cov = coverage.Coverage()
cov.start()
- import TheCode # pragma: nested # pylint: disable=import-error, unused-variable
+ import TheCode # pragma: nested # pylint: disable=import-error, unused-import
cov.stop() # pragma: nested
return self.get_report(cov)
@@ -660,7 +660,7 @@ class SummaryTest(UsingModulesMixin, CoverageTest):
""")
cov = coverage.Coverage()
cov.start()
- import start # pragma: nested # pylint: disable=import-error, unused-variable
+ import start # pragma: nested # pylint: disable=import-error, unused-import
cov.stop() # pragma: nested
report = self.get_report(cov)
@@ -680,7 +680,7 @@ class SummaryTest(UsingModulesMixin, CoverageTest):
# Run the program.
cov = coverage.Coverage()
cov.start()
- import main # pragma: nested # pylint: disable=import-error, unused-variable
+ import main # pragma: nested # pylint: disable=unused-import
cov.stop() # pragma: nested
report = self.get_report(cov).splitlines()
@@ -710,7 +710,7 @@ class SummaryTest(UsingModulesMixin, CoverageTest):
# Run the program.
cov = coverage.Coverage()
cov.start()
- import main # pragma: nested # pylint: disable=import-error, unused-variable
+ import main # pragma: nested # pylint: disable=unused-import
cov.stop() # pragma: nested
# Put back the missing Python file.
@@ -730,7 +730,7 @@ class SummaryTest2(UsingModulesMixin, CoverageTest):
# statements, not one statement.
cov = coverage.Coverage(branch=True)
cov.start()
- import usepkgs # pragma: nested # pylint: disable=import-error, unused-variable
+ import usepkgs # pragma: nested # pylint: disable=import-error, unused-import
cov.stop() # pragma: nested
repout = StringIO()
@@ -803,7 +803,7 @@ class TestSummaryReporterConfiguration(CoverageTest):
cov = Coverage(source=["."], omit=["doit.py"])
cov.start()
- import doit # pragma: nested # pylint: disable=import-error, unused-variable
+ import doit # pragma: nested # pylint: disable=import-error, unused-import
cov.stop() # pragma: nested
printer = SummaryReporter(cov, options)
destination = StringIO()
diff --git a/tests/test_templite.py b/tests/test_templite.py
index 04150024..be58fe91 100644
--- a/tests/test_templite.py
+++ b/tests/test_templite.py
@@ -10,7 +10,7 @@ from coverage.templite import Templite, TempliteSyntaxError, TempliteValueError
from tests.coveragetest import CoverageTest
-# pylint: disable=unused-variable
+# pylint: disable=possibly-unused-variable
class AnyOldObject(object):
"""Simple testing object.