MCPcopy Index your code
hub / github.com/dask/dask / test_register_command_ep

Function test_register_command_ep

dask/tests/test_cli.py:211–242  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

209
210
211def test_register_command_ep():
212 from dask.cli import _register_command_ep
213
214 bad_ep = importlib_metadata.EntryPoint(
215 name="bad",
216 value="dask.tests.test_cli:bad_command",
217 group="dask_cli",
218 )
219
220 good_ep = importlib_metadata.EntryPoint(
221 name="good",
222 value="dask.tests.test_cli:good_command",
223 group="dask_cli",
224 )
225
226 class ErrorEP:
227 @property
228 def name(self):
229 return "foo"
230
231 def load(self):
232 raise ImportError("Entrypoint could not be imported")
233
234 with pytest.warns(UserWarning, match="must be instances of"):
235 _register_command_ep(dummy_cli, bad_ep)
236
237 with pytest.warns(UserWarning, match="exception occurred"):
238 _register_command_ep(dummy_cli, ErrorEP())
239
240 _register_command_ep(dummy_cli, good_ep)
241 assert "good" in dummy_cli.commands
242 assert dummy_cli.commands["good"] is good_command
243
244
245@click.group()

Callers

nothing calls this directly

Calls 2

_register_command_epFunction · 0.90
ErrorEPClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…