summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-03-06 09:33:47 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-03-11 06:38:35 -0500
commitaf234f4a2a08dc1616c2270df6349925221c81e8 (patch)
tree71f7946c36f189d67e9b2e50a4f80799c3d3df27
parent26e2f9b6f22fd29efe3e4bd7df63acc144950c80 (diff)
downloadpython-coveragepy-git-af234f4a2a08dc1616c2270df6349925221c81e8.tar.gz
test: have pytest collect test classes uniformly
-rw-r--r--setup.cfg1
-rw-r--r--tests/test_annotate.py2
-rw-r--r--tests/test_backward.py6
-rw-r--r--tests/test_data.py2
-rw-r--r--tests/test_html.py2
-rw-r--r--tests/test_plugins.py2
-rw-r--r--tests/test_summary.py11
7 files changed, 9 insertions, 17 deletions
diff --git a/setup.cfg b/setup.cfg
index 7ba8525a..10962a72 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,6 @@
[tool:pytest]
addopts = -q -n3 --strict --force-flaky --no-flaky-report -rfe --failed-first
+python_classes = *Test
markers =
expensive: too slow to run during "make smoke"
diff --git a/tests/test_annotate.py b/tests/test_annotate.py
index 3c2b1a2c..051a31ee 100644
--- a/tests/test_annotate.py
+++ b/tests/test_annotate.py
@@ -10,7 +10,7 @@ from tests.coveragetest import CoverageTest
from tests.goldtest import compare, gold_path
-class AnnotationGoldTest1(CoverageTest):
+class AnnotationGoldTest(CoverageTest):
"""Test the annotate feature with gold files."""
def make_multi(self):
diff --git a/tests/test_backward.py b/tests/test_backward.py
index d750022b..b40a174b 100644
--- a/tests/test_backward.py
+++ b/tests/test_backward.py
@@ -3,13 +3,13 @@
"""Tests that our version shims in backward.py are working."""
-import unittest
-
from coverage.backward import iitems, binary_bytes, bytes_to_ints
+from tests.coveragetest import CoverageTest
from tests.helpers import assert_count_equal
-class BackwardTest(unittest.TestCase):
+
+class BackwardTest(CoverageTest):
"""Tests of things from backward.py."""
def test_iitems(self):
diff --git a/tests/test_data.py b/tests/test_data.py
index eac9c36f..190231c7 100644
--- a/tests/test_data.py
+++ b/tests/test_data.py
@@ -502,7 +502,7 @@ class CoverageDataTest(DataTestHelpers, CoverageTest):
self.assert_lines1_data(covdata)
-class CoverageDataTestInTempDir(DataTestHelpers, CoverageTest):
+class CoverageDataInTempDirTest(DataTestHelpers, CoverageTest):
"""Tests of CoverageData that need a temporary directory to make files."""
def test_read_write_lines(self):
diff --git a/tests/test_html.py b/tests/test_html.py
index 51e0b93c..79d14d26 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -644,7 +644,7 @@ def compare_html(expected, actual):
compare(expected, actual, file_pattern="*.html", scrubs=scrubs)
-class HtmlGoldTests(CoverageTest):
+class HtmlGoldTest(CoverageTest):
"""Tests of HTML reporting that use gold files."""
def test_a(self):
diff --git a/tests/test_plugins.py b/tests/test_plugins.py
index aeffdb80..59be645c 100644
--- a/tests/test_plugins.py
+++ b/tests/test_plugins.py
@@ -257,7 +257,7 @@ class PluginTest(CoverageTest):
@pytest.mark.skipif(env.C_TRACER, reason="This test is only about PyTracer.")
-class PluginWarningOnPyTracer(CoverageTest):
+class PluginWarningOnPyTracerTest(CoverageTest):
"""Test that we get a controlled exception with plugins on PyTracer."""
def test_exception_if_plugins_on_pytracer(self):
self.make_file("simple.py", "a = 1")
diff --git a/tests/test_summary.py b/tests/test_summary.py
index 8596c45c..13daca14 100644
--- a/tests/test_summary.py
+++ b/tests/test_summary.py
@@ -774,15 +774,6 @@ class SummaryTest(UsingModulesMixin, CoverageTest):
report = self.get_report(cov).splitlines()
assert "mod.py 1 0 100%" in report
-
-class SummaryTest2(UsingModulesMixin, CoverageTest):
- """Another bunch of summary tests."""
- # This class exists because tests naturally clump into classes based on the
- # needs of their setUp, rather than the product features they are testing.
- # There's probably a better way to organize these.
-
- run_in_temp_dir = False
-
def test_empty_files(self):
# Shows that empty files like __init__.py are listed as having zero
# statements, not one statement.
@@ -835,7 +826,7 @@ class ReportingReturnValueTest(CoverageTest):
assert round(abs(val-85.7), 1) == 0
-class TestSummaryReporterConfiguration(CoverageTest):
+class SummaryReporterConfigurationTest(CoverageTest):
"""Tests of SummaryReporter."""
def make_rigged_file(self, filename, stmts, miss):