diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2023-01-12 10:47:08 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2023-01-12 10:47:08 -0500 |
commit | a15b90268f37d5f3a06b28ecb9277e636b493b1d (patch) | |
tree | 04fa3e38f18bb1489abd2004abca81b23eb5e3ac /tests | |
parent | 460dd98dae56d26f0611a0f6dc9c24e44435958f (diff) | |
download | python-coveragepy-git-a15b90268f37d5f3a06b28ecb9277e636b493b1d.tar.gz |
mypy: progress on test_plugins.py
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_plugins.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 866fab87..ab1f6b5f 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -3,10 +3,14 @@ """Tests for plugins.""" +from __future__ import annotations + import inspect import io import math import os.path + +from typing import Any, Dict, List from xml.etree import ElementTree import pytest @@ -17,6 +21,7 @@ from coverage.control import Plugins from coverage.data import line_counts, sorted_lines from coverage.exceptions import CoverageWarning, NoSource, PluginError from coverage.misc import import_local_file +from coverage.types import TConfigSectionOut, TPluginConfig import coverage.plugin @@ -24,18 +29,18 @@ from tests.coveragetest import CoverageTest from tests.helpers import CheckUniqueFilenames, swallow_warnings -class FakeConfig: +class FakeConfig(TPluginConfig): """A fake config for use in tests.""" - def __init__(self, plugin, options) -> None: + def __init__(self, plugin: str, options: Dict[str, Any]) -> None: self.plugin = plugin self.options = options - self.asked_for = [] + self.asked_for: List[str] = [] - def get_plugin_options(self, module): - """Just return the options for `module` if this is the right module.""" - self.asked_for.append(module) - if module == self.plugin: + def get_plugin_options(self, plugin: str) -> TConfigSectionOut: + """Just return the options for `plugin` if this is the right module.""" + self.asked_for.append(plugin) + if plugin == self.plugin: return self.options else: return {} |