diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2020-11-14 16:03:54 +0100 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2020-11-28 16:09:53 +0100 |
commit | ebd35f03c7b8f7d76b83835df5e9cea287b941b1 (patch) | |
tree | 154a921e7706e033c831fcdb83085de555380bed | |
parent | e83e7792e5a90d13e9fc5f2c003f45f0e80ff5dd (diff) | |
download | pylint-git-ebd35f03c7b8f7d76b83835df5e9cea287b941b1.tar.gz |
Fix PytestCollectionWarning: cannot collect test class TestReporter
-rw-r--r-- | pylint/testutils/__init__.py | 4 | ||||
-rw-r--r-- | pylint/testutils/reporter_for_tests.py (renamed from pylint/testutils/test_reporter.py) | 2 | ||||
-rw-r--r-- | pylint/testutils/utils.py | 7 | ||||
-rw-r--r-- | tests/benchmark/test_baseline_benchmarks.py | 2 | ||||
-rw-r--r-- | tests/lint/unittest_lint.py | 14 | ||||
-rw-r--r-- | tests/profile/test_profile_against_externals.py | 4 | ||||
-rw-r--r-- | tests/test_check_parallel.py | 2 | ||||
-rw-r--r-- | tests/test_import_graph.py | 2 | ||||
-rw-r--r-- | tests/test_regr.py | 2 |
9 files changed, 20 insertions, 19 deletions
diff --git a/pylint/testutils/__init__.py b/pylint/testutils/__init__.py index d059417db..348d2bf36 100644 --- a/pylint/testutils/__init__.py +++ b/pylint/testutils/__init__.py @@ -38,11 +38,11 @@ __all__ = [ "Message", "MinimalTestReporter", "set_config", - "TestReporter", + "GenericTestReporter", "UPDATE_OPTION", ] -from pylint.testutils.test_reporter import MinimalTestReporter, TestReporter +from pylint.testutils.reporter_for_tests import GenericTestReporter, MinimalTestReporter from pylint.testutils.utils import ( UPDATE_OPTION, CheckerTestCase, diff --git a/pylint/testutils/test_reporter.py b/pylint/testutils/reporter_for_tests.py index 027c3901f..33d94dee0 100644 --- a/pylint/testutils/test_reporter.py +++ b/pylint/testutils/reporter_for_tests.py @@ -8,7 +8,7 @@ from pylint import interfaces from pylint.reporters import BaseReporter -class TestReporter(BaseReporter): +class GenericTestReporter(BaseReporter): """reporter storing plain text messages""" __implements__ = interfaces.IReporter diff --git a/pylint/testutils/utils.py b/pylint/testutils/utils.py index 477f64156..f2b45e2d5 100644 --- a/pylint/testutils/utils.py +++ b/pylint/testutils/utils.py @@ -24,7 +24,10 @@ import pytest from pylint import checkers, interfaces from pylint.lint import PyLinter -from pylint.testutils.test_reporter import FunctionalTestReporter, TestReporter +from pylint.testutils.reporter_for_tests import ( + FunctionalTestReporter, + GenericTestReporter, +) from pylint.utils import ASTWalker SYS_VERS_STR = "%d%d%d" % sys.version_info[:3] @@ -183,7 +186,7 @@ class CheckerTestCase: # Init -test_reporter = TestReporter() +test_reporter = GenericTestReporter() linter = PyLinter() linter.set_reporter(test_reporter) linter.config.persistent = 0 diff --git a/tests/benchmark/test_baseline_benchmarks.py b/tests/benchmark/test_baseline_benchmarks.py index ed9f599d3..3d642c33f 100644 --- a/tests/benchmark/test_baseline_benchmarks.py +++ b/tests/benchmark/test_baseline_benchmarks.py @@ -16,7 +16,7 @@ import pytest import pylint.interfaces from pylint.checkers.base_checker import BaseChecker from pylint.lint import PyLinter, Run, check_parallel -from pylint.testutils import TestReporter as Reporter +from pylint.testutils import GenericTestReporter as Reporter from pylint.utils import register_plugins diff --git a/tests/lint/unittest_lint.py b/tests/lint/unittest_lint.py index d60ea957a..3ce1d5e24 100644 --- a/tests/lint/unittest_lint.py +++ b/tests/lint/unittest_lint.py @@ -242,7 +242,7 @@ def disable(): @pytest.fixture(scope="module") def reporter(): - return testutils.TestReporter + return testutils.GenericTestReporter @pytest.fixture @@ -480,7 +480,7 @@ def test_disable_alot(linter): def test_addmessage(linter): - linter.set_reporter(testutils.TestReporter()) + linter.set_reporter(testutils.GenericTestReporter()) linter.open() linter.set_current_module("0123") linter.add_message("C0301", line=1, args=(1, 2)) @@ -492,7 +492,7 @@ def test_addmessage(linter): def test_addmessage_invalid(linter): - linter.set_reporter(testutils.TestReporter()) + linter.set_reporter(testutils.GenericTestReporter()) linter.open() linter.set_current_module("0123") @@ -570,7 +570,7 @@ def test_init_hooks_called_before_load_plugins(): def test_analyze_explicit_script(linter): - linter.set_reporter(testutils.TestReporter()) + linter.set_reporter(testutils.GenericTestReporter()) linter.check(os.path.join(DATA_DIR, "ascript")) assert ["C: 2: Line too long (175/100)"] == linter.reporter.messages @@ -768,7 +768,7 @@ def test_custom_should_analyze_file(): wrong_file = os.path.join(package_dir, "wrong.py") for jobs in [1, 2]: - reporter = testutils.TestReporter() + reporter = testutils.GenericTestReporter() linter = _CustomPyLinter() linter.config.jobs = jobs linter.config.persistent = 0 @@ -801,7 +801,7 @@ def test_multiprocessing(jobs): "wrong_import_position.py", ] - reporter = testutils.TestReporter() + reporter = testutils.GenericTestReporter() linter = PyLinter() linter.config.jobs = jobs linter.config.persistent = 0 @@ -822,7 +822,7 @@ def test_filename_with__init__(init_linter): # This tracks a regression where a file whose name ends in __init__.py, # such as flycheck__init__.py, would accidentally lead to linting the # entire containing directory. - reporter = testutils.TestReporter() + reporter = testutils.GenericTestReporter() linter = init_linter linter.open() linter.set_reporter(reporter) diff --git a/tests/profile/test_profile_against_externals.py b/tests/profile/test_profile_against_externals.py index e7159264b..4bbac7556 100644 --- a/tests/profile/test_profile_against_externals.py +++ b/tests/profile/test_profile_against_externals.py @@ -8,13 +8,11 @@ import os import pprint -import shutil -import tempfile import pytest from pylint.lint import Run -from pylint.testutils import TestReporter as Reporter +from pylint.testutils import GenericTestReporter as Reporter def _get_py_files(scanpath): diff --git a/tests/test_check_parallel.py b/tests/test_check_parallel.py index f44ce666d..e8f67f4b6 100644 --- a/tests/test_check_parallel.py +++ b/tests/test_check_parallel.py @@ -18,7 +18,7 @@ from pylint.lint import PyLinter from pylint.lint.parallel import _worker_check_single_file as worker_check_single_file from pylint.lint.parallel import _worker_initialize as worker_initialize from pylint.lint.parallel import check_parallel -from pylint.testutils import TestReporter as Reporter +from pylint.testutils import GenericTestReporter as Reporter def _gen_file_data(idx=0): diff --git a/tests/test_import_graph.py b/tests/test_import_graph.py index 0d4ea7f04..a57e2c880 100644 --- a/tests/test_import_graph.py +++ b/tests/test_import_graph.py @@ -58,7 +58,7 @@ URL="." node[shape="box"] @pytest.fixture def linter(): - l = PyLinter(reporter=testutils.TestReporter()) + l = PyLinter(reporter=testutils.GenericTestReporter()) initialize(l) return l diff --git a/tests/test_regr.py b/tests/test_regr.py index a26cc1be1..c7a8d56b7 100644 --- a/tests/test_regr.py +++ b/tests/test_regr.py @@ -38,7 +38,7 @@ except AttributeError: @pytest.fixture(scope="module") def reporter(): - return testutils.TestReporter + return testutils.GenericTestReporter @pytest.fixture(scope="module") |