Remove support to pass strings to pytest.main()

Fix #3085
This commit is contained in:
Bruno Oliveira
2018-12-14 15:19:48 -02:00
parent 6e1b1abfa7
commit a7e401656e
6 changed files with 34 additions and 56 deletions

View File

@@ -173,12 +173,9 @@ def _prepareconfig(args=None, plugins=None):
elif isinstance(args, py.path.local):
args = [str(args)]
elif not isinstance(args, (tuple, list)):
if not isinstance(args, str):
raise ValueError("not a string or argument list: %r" % (args,))
args = shlex.split(args, posix=sys.platform != "win32")
from _pytest import deprecated
msg = "`args` parameter expected to be a list or tuple of strings, got: {!r} (type: {})"
raise TypeError(msg.format(args, type(args)))
warning = deprecated.MAIN_STR_ARGS
config = get_config()
pluginmanager = config.pluginmanager
try:

View File

@@ -17,11 +17,6 @@ from _pytest.warning_types import RemovedInPytest4Warning
from _pytest.warning_types import UnformattedWarning
MAIN_STR_ARGS = RemovedInPytest4Warning(
"passing a string to pytest.main() is deprecated, "
"pass a list of arguments instead."
)
YIELD_TESTS = "yield tests were removed in pytest 4.0 - {name} will be ignored"