drop resolve_collection_argument cosmetic change
add more test cases for resolve_collection_argument
This commit is contained in:
parent
7d192afeaf
commit
2b4563d77a
|
@ -886,7 +886,8 @@ def resolve_collection_argument(
|
||||||
parts[-1] = f"{parts[-1]}{squacket}{rest}"
|
parts[-1] = f"{parts[-1]}{squacket}{rest}"
|
||||||
if as_pypath:
|
if as_pypath:
|
||||||
strpath = search_pypath(strpath)
|
strpath = search_pypath(strpath)
|
||||||
fspath = absolutepath(invocation_path / strpath)
|
fspath = invocation_path / strpath
|
||||||
|
fspath = absolutepath(fspath)
|
||||||
if not fspath.exists():
|
if not fspath.exists():
|
||||||
msg = (
|
msg = (
|
||||||
"module or package not found: {arg} (missing __init__.py?)"
|
"module or package not found: {arg} (missing __init__.py?)"
|
||||||
|
|
|
@ -180,6 +180,10 @@ class TestResolveCollectionArgument:
|
||||||
invocation_path / "src/pkg",
|
invocation_path / "src/pkg",
|
||||||
[],
|
[],
|
||||||
)
|
)
|
||||||
|
assert resolve_collection_argument(invocation_path, "src/pkg/test.py::") == (
|
||||||
|
invocation_path / "src/pkg/test.py",
|
||||||
|
[],
|
||||||
|
)
|
||||||
|
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
UsageError, match=r"package argument cannot contain :: selection parts"
|
UsageError, match=r"package argument cannot contain :: selection parts"
|
||||||
|
@ -207,6 +211,12 @@ class TestResolveCollectionArgument:
|
||||||
):
|
):
|
||||||
resolve_collection_argument(invocation_path, "src/pkg/test.py[a::b]")
|
resolve_collection_argument(invocation_path, "src/pkg/test.py[a::b]")
|
||||||
|
|
||||||
|
with pytest.raises(
|
||||||
|
UsageError,
|
||||||
|
match=re.escape("file or directory not found: src/pkg/test.py[foobar]"),
|
||||||
|
):
|
||||||
|
resolve_collection_argument(invocation_path, "src/pkg/test.py[foobar]")
|
||||||
|
|
||||||
with pytest.raises(
|
with pytest.raises(
|
||||||
UsageError,
|
UsageError,
|
||||||
match=re.escape(
|
match=re.escape(
|
||||||
|
|
Loading…
Reference in New Issue