1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
import pytest
from cyclopts import CommandCollisionError
def test_command_collision(app):
@app.command
def foo():
pass
with pytest.raises(CommandCollisionError):
@app.command
def foo(): # noqa: F811
pass
with pytest.raises(CommandCollisionError):
@app.command(name="foo")
def bar():
pass
def test_command_collision_meta(app):
@app.command
def foo():
pass
with pytest.raises(CommandCollisionError):
@app.meta.command
def foo(): # noqa: F811
pass
with pytest.raises(CommandCollisionError):
@app.meta.command(name="foo")
def bar():
pass
def test_command_collision_default(app):
"""Cannot register multiple functions to default."""
@app.default
def foo():
pass
with pytest.raises(CommandCollisionError):
@app.default
def bar():
pass
|