Skip to content

Commit 1873724

Browse files
committed
Add test for handling ClickExceptions
1 parent a375783 commit 1873724

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

djclick/test/test_adapter.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,13 @@ def test_django_traceback(manage):
170170
assert e.returncode == 1
171171

172172

173+
def test_click_exception(manage):
174+
with pytest.raises(subprocess.CalledProcessError) as e:
175+
manage("clickexceptioncmd")
176+
assert e.value.output == b"Error: Raised error description\n"
177+
assert e.value.returncode == 1
178+
179+
173180
def test_django_settings(manage):
174181
# The --settings switch only works from the command line (or if the django
175182
# settings where not setup before)... this means that we have to call it
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import djclick as click
2+
3+
4+
@click.command(version="20.0")
5+
def command():
6+
raise click.ClickException("Raised error description")

0 commit comments

Comments
 (0)