diff --git a/_pytest/config.py b/_pytest/config.py index fe386ed0b1..b1aec120c6 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -1257,9 +1257,13 @@ def get_common_ancestor(args): def get_dirs_from_args(args): - return [d for d in (py.path.local(x) for x in args - if not str(x).startswith("-")) - if d.exists()] + possible_dirs = [ + py.path.local(str(arg).split('::')[0]) + for arg in args + if not str(arg).startswith('-') + ] + + return [d for d in possible_dirs if d.exists()] def determine_setup(inifile, args, warnfunc=None):