summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pylintrc4
-rw-r--r--tests/coveragetest.py8
-rw-r--r--tests/mixins.py7
-rw-r--r--tests/test_cmdline.py4
-rw-r--r--tests/test_files.py4
-rw-r--r--tests/test_goldtest.py4
-rw-r--r--tests/test_html.py4
-rw-r--r--tests/test_numbits.py4
-rw-r--r--tests/test_process.py12
-rw-r--r--tests/test_setup.py4
10 files changed, 26 insertions, 29 deletions
diff --git a/pylintrc b/pylintrc
index 0b1f9d7e..c295e4d0 100644
--- a/pylintrc
+++ b/pylintrc
@@ -148,7 +148,7 @@ evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / stateme
# TestCase overrides don't: setUp, tearDown
# Nested decorator implementations: _decorator, _wrapper
# Dispatched methods don't: _xxx__Xxxx
-no-docstring-rgx=__.*__|test[A-Z_].*|setup_test|_decorator|_wrapper|_.*__.*
+no-docstring-rgx=__.*__|test[A-Z_].*|setUp|_decorator|_wrapper|_.*__.*
# Regular expression which should only match correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
@@ -236,7 +236,7 @@ additional-builtins=
[CLASSES]
# List of method names used to declare (i.e. assign) instance attributes.
-defining-attr-methods=__init__,__new__,setup_test,reset
+defining-attr-methods=__init__,__new__,setUp,reset
# checks for sign of poor/misdesign:
diff --git a/tests/coveragetest.py b/tests/coveragetest.py
index a4e0ee02..0960722b 100644
--- a/tests/coveragetest.py
+++ b/tests/coveragetest.py
@@ -51,8 +51,8 @@ class CoverageTest(
# Let stderr go to stderr, pytest will capture it for us.
show_stderr = True
- def setup_test(self):
- super().setup_test()
+ def setUp(self):
+ super().setUp()
# Attributes for getting info about what happened.
self.last_command_status = None
@@ -455,8 +455,8 @@ class CoverageTest(
class UsingModulesMixin:
"""A mixin for importing modules from tests/modules and tests/moremodules."""
- def setup_test(self):
- super().setup_test()
+ def setUp(self):
+ super().setUp()
# Parent class saves and restores sys.path, we can just modify it.
sys.path.append(nice_file(TESTS_DIR, "modules"))
diff --git a/tests/mixins.py b/tests/mixins.py
index 1043c2d2..e55a05b9 100644
--- a/tests/mixins.py
+++ b/tests/mixins.py
@@ -27,12 +27,9 @@ class PytestBase:
# pylint: disable=attribute-defined-outside-init
self._pytest_request = request
self._monkeypatch = monkeypatch
- self.setup_test()
+ self.setUp()
- # Can't call this setUp or setup because pytest sniffs out unittest and
- # nosetest special names, and does things with them.
- # https://github.com/pytest-dev/pytest/issues/8424
- def setup_test(self):
+ def setUp(self):
"""Per-test initialization. Override this as you wish."""
pass
diff --git a/tests/test_cmdline.py b/tests/test_cmdline.py
index acd5fa29..4c0776fb 100644
--- a/tests/test_cmdline.py
+++ b/tests/test_cmdline.py
@@ -940,8 +940,8 @@ class CmdMainTest(CoverageTest):
raise AssertionError(f"Bad CoverageScriptStub: {argv!r}")
return 0
- def setup_test(self):
- super().setup_test()
+ def setUp(self):
+ super().setUp()
old_CoverageScript = coverage.cmdline.CoverageScript
coverage.cmdline.CoverageScript = self.CoverageScriptStub
self.addCleanup(setattr, coverage.cmdline, 'CoverageScript', old_CoverageScript)
diff --git a/tests/test_files.py b/tests/test_files.py
index 9c92fd76..de0dbbd5 100644
--- a/tests/test_files.py
+++ b/tests/test_files.py
@@ -144,8 +144,8 @@ def test_fnmatches_to_regex(patterns, case_insensitive, partial, matches, nomatc
class MatcherTest(CoverageTest):
"""Tests of file matchers."""
- def setup_test(self):
- super().setup_test()
+ def setUp(self):
+ super().setUp()
files.set_relative_directory()
def assertMatches(self, matcher, filepath, matches):
diff --git a/tests/test_goldtest.py b/tests/test_goldtest.py
index 73e0e188..4462d5ab 100644
--- a/tests/test_goldtest.py
+++ b/tests/test_goldtest.py
@@ -48,8 +48,8 @@ OUT_PATH_RX = path_regex("out/gettysburg.txt")
class CompareTest(CoverageTest):
"""Tests of goldtest.py:compare()"""
- def setup_test(self):
- super().setup_test()
+ def setUp(self):
+ super().setUp()
self.addCleanup(remove_tree, ACTUAL_DIR)
def test_good(self):
diff --git a/tests/test_html.py b/tests/test_html.py
index ab7422ea..51062f73 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -111,8 +111,8 @@ class FileWriteTracker:
class HtmlDeltaTest(HtmlTestHelpers, CoverageTest):
"""Tests of the HTML delta speed-ups."""
- def setup_test(self):
- super().setup_test()
+ def setUp(self):
+ super().setUp()
# At least one of our tests monkey-patches the version of coverage.py,
# so grab it here to restore it later.
diff --git a/tests/test_numbits.py b/tests/test_numbits.py
index f7032de7..359097b6 100644
--- a/tests/test_numbits.py
+++ b/tests/test_numbits.py
@@ -98,8 +98,8 @@ class NumbitsSqliteFunctionTest(CoverageTest):
run_in_temp_dir = False
- def setup_test(self):
- super().setup_test()
+ def setUp(self):
+ super().setUp()
conn = sqlite3.connect(":memory:")
register_sqlite_functions(conn)
self.cursor = conn.cursor()
diff --git a/tests/test_process.py b/tests/test_process.py
index b8f268f7..b6c09f66 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -1236,8 +1236,8 @@ class PydocTest(CoverageTest):
class FailUnderTest(CoverageTest):
"""Tests of the --fail-under switch."""
- def setup_test(self):
- super().setup_test()
+ def setUp(self):
+ super().setUp()
self.make_file("forty_two_plus.py", """\
# I have 42.857% (3/7) coverage!
a = 1
@@ -1473,8 +1473,8 @@ def persistent_remove(path):
class ProcessCoverageMixin:
"""Set up a .pth file to coverage-measure all sub-processes."""
- def setup_test(self):
- super().setup_test()
+ def setUp(self):
+ super().setUp()
# Create the .pth file.
assert PTH_DIR
@@ -1490,8 +1490,8 @@ class ProcessCoverageMixin:
class ProcessStartupTest(ProcessCoverageMixin, CoverageTest):
"""Test that we can measure coverage in sub-processes."""
- def setup_test(self):
- super().setup_test()
+ def setUp(self):
+ super().setUp()
# Main will run sub.py
self.make_file("main.py", """\
diff --git a/tests/test_setup.py b/tests/test_setup.py
index 0d64319c..aa65af78 100644
--- a/tests/test_setup.py
+++ b/tests/test_setup.py
@@ -15,8 +15,8 @@ class SetupPyTest(CoverageTest):
run_in_temp_dir = False
- def setup_test(self):
- super().setup_test()
+ def setUp(self):
+ super().setUp()
# Force the most restrictive interpretation.
self.set_environ('LC_ALL', 'C')