summaryrefslogtreecommitdiff
path: root/testing/test_findpaths.py
diff options
context:
space:
mode:
authorBruno Oliveira <nicoddemus@gmail.com>2020-08-12 17:17:43 -0300
committerBruno Oliveira <nicoddemus@gmail.com>2020-08-12 17:20:09 -0300
commit36c8bb492e309eb16cb83b9acf85b24b7dc47030 (patch)
treed251147412e101251b7180e0bf2d95a18c780bab /testing/test_findpaths.py
parent15d8293241e5cc3e6256f41963ea3204d5b55117 (diff)
downloadpytest-36c8bb492e309eb16cb83b9acf85b24b7dc47030.tar.gz
get_dirs_from_args handles paths with invalid syntax
Fix #7638
Diffstat (limited to 'testing/test_findpaths.py')
-rw-r--r--testing/test_findpaths.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/testing/test_findpaths.py b/testing/test_findpaths.py
index acb982b4c..974dcf8f3 100644
--- a/testing/test_findpaths.py
+++ b/testing/test_findpaths.py
@@ -2,6 +2,7 @@ from textwrap import dedent
import pytest
from _pytest.config.findpaths import get_common_ancestor
+from _pytest.config.findpaths import get_dirs_from_args
from _pytest.config.findpaths import load_config_dict_from_file
from _pytest.pathlib import Path
@@ -108,3 +109,17 @@ class TestCommonAncestor:
fn = tmp_path / "foo.py"
fn.touch()
assert get_common_ancestor([fn]) == tmp_path
+
+
+def test_get_dirs_from_args(tmp_path):
+ """get_dirs_from_args() skips over non-existing directories and files"""
+ fn = tmp_path / "foo.py"
+ fn.touch()
+ d = tmp_path / "tests"
+ d.mkdir()
+ option = "--foobar=/foo.txt"
+ # xdist uses options in this format for its rsync feature (#7638)
+ xdist_rsync_option = "popen=c:/dest"
+ assert get_dirs_from_args(
+ [str(fn), str(tmp_path / "does_not_exist"), str(d), option, xdist_rsync_option]
+ ) == [fn.parent, d]