MCPcopy
hub / github.com/pytest-dev/pytest / test_file

Method test_file

testing/test_main.py:121–167  ·  view source on GitHub ↗

File and parts.

(self, invocation_path: Path)

Source from the content-addressed store, hash-verified

119 return pytester.path
120
121 def test_file(self, invocation_path: Path) -> None:
122 """File and parts."""
123 assert resolve_collection_argument(
124 invocation_path, "src/pkg/test.py", 0
125 ) == CollectionArgument(
126 path=invocation_path / "src/pkg/test.py",
127 parts=[],
128 parametrization=None,
129 module_name=None,
130 original_index=0,
131 )
132 assert resolve_collection_argument(
133 invocation_path, "src/pkg/test.py::", 10
134 ) == CollectionArgument(
135 path=invocation_path / "src/pkg/test.py",
136 parts=[""],
137 parametrization=None,
138 module_name=None,
139 original_index=10,
140 )
141 assert resolve_collection_argument(
142 invocation_path, "src/pkg/test.py::foo::bar", 20
143 ) == CollectionArgument(
144 path=invocation_path / "src/pkg/test.py",
145 parts=["foo", "bar"],
146 parametrization=None,
147 module_name=None,
148 original_index=20,
149 )
150 assert resolve_collection_argument(
151 invocation_path, "src/pkg/test.py::foo::bar::", 30
152 ) == CollectionArgument(
153 path=invocation_path / "src/pkg/test.py",
154 parts=["foo", "bar", ""],
155 parametrization=None,
156 module_name=None,
157 original_index=30,
158 )
159 assert resolve_collection_argument(
160 invocation_path, "src/pkg/test.py::foo::bar[a,b,c]", 40
161 ) == CollectionArgument(
162 path=invocation_path / "src/pkg/test.py",
163 parts=["foo", "bar"],
164 parametrization="[a,b,c]",
165 module_name=None,
166 original_index=40,
167 )
168
169 def test_dir(self, invocation_path: Path) -> None:
170 """Directory and parts."""

Callers

nothing calls this directly

Calls 2

CollectionArgumentClass · 0.90

Tested by

no test coverage detected