diff options
author | Ran Benita <ran@unusedvar.com> | 2020-06-23 11:38:21 +0300 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2020-06-23 11:47:52 +0300 |
commit | 8994e1e3a17bd625e0c258d0a402062542908fe3 (patch) | |
tree | 5c34b259c04c8eb28978103cadfd914cf05bcdd9 /testing/test_config.py | |
parent | 4655b7998540d47e6f8dd783c82b37588719556d (diff) | |
download | pytest-8994e1e3a17bd625e0c258d0a402062542908fe3.tar.gz |
config: make _get_plugin_specs_as_list a little clearer and more general
Diffstat (limited to 'testing/test_config.py')
-rw-r--r-- | testing/test_config.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/testing/test_config.py b/testing/test_config.py index c1e4471b9..bc0da93a5 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -11,6 +11,7 @@ import py.path import _pytest._code import pytest from _pytest.compat import importlib_metadata +from _pytest.config import _get_plugin_specs_as_list from _pytest.config import _iter_rewritable_modules from _pytest.config import Config from _pytest.config import ConftestImportFailure @@ -1115,21 +1116,17 @@ def test_load_initial_conftest_last_ordering(_config_for_test): assert [x.function.__module__ for x in values] == expected -def test_get_plugin_specs_as_list(): - from _pytest.config import _get_plugin_specs_as_list - - def exp_match(val): +def test_get_plugin_specs_as_list() -> None: + def exp_match(val: object) -> str: return ( - "Plugin specs must be a ','-separated string" - " or a list/tuple of strings for plugin names. Given: {}".format( - re.escape(repr(val)) - ) + "Plugins may be specified as a sequence or a ','-separated string of plugin names. Got: %s" + % re.escape(repr(val)) ) with pytest.raises(pytest.UsageError, match=exp_match({"foo"})): - _get_plugin_specs_as_list({"foo"}) + _get_plugin_specs_as_list({"foo"}) # type: ignore[arg-type] with pytest.raises(pytest.UsageError, match=exp_match({})): - _get_plugin_specs_as_list(dict()) + _get_plugin_specs_as_list(dict()) # type: ignore[arg-type] assert _get_plugin_specs_as_list(None) == [] assert _get_plugin_specs_as_list("") == [] |