Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,15 @@ def get_plugin_manager():
return get_config().pluginmanager


def _prepareconfig(args=None, plugins=None):
def _prepareconfig(
args: Optional[Union[py.path.local, List[str]]] = None, plugins=None
):
if args is None:
args = sys.argv[1:]
elif isinstance(args, py.path.local):
args = [str(args)]
elif not isinstance(args, (tuple, list)):
msg = "`args` parameter expected to be a list or tuple of strings, got: {!r} (type: {})"
elif not isinstance(args, list):
msg = "`args` parameter expected to be a list of strings, got: {!r} (type: {})"
raise TypeError(msg.format(args, type(args)))

config = get_config(args, plugins)
Expand Down
2 changes: 1 addition & 1 deletion testing/acceptance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ def test_equivalence_pytest_pytest(self):

def test_invoke_with_invalid_type(self):
with pytest.raises(
TypeError, match="expected to be a list or tuple of strings, got: '-h'"
TypeError, match="expected to be a list of strings, got: '-h'"
):
pytest.main("-h")

Expand Down