Skip to content

Commit 85fc141

Browse files
Andreas Maieryoavram
authored andcommitted
CM exit function returns False to follow CM convention.
Signed-off-by: Andreas Maier <andras.r.maier@gmx.de>
1 parent c675c66 commit 85fc141

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

click_spinner/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def __enter__(self):
3636

3737
def __exit__(self, exc_type, exc_val, exc_tb):
3838
self.stop()
39+
return False
3940

4041

4142
def spinner(force=False):

tests/test_spinner.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,18 @@ def cli():
9090
result = runner.invoke(cli, [])
9191
assert result.exception is None
9292

93+
class CMException(Exception):
94+
pass
95+
96+
97+
def test_spinner_exc():
98+
@click.command()
99+
def cli():
100+
with click_spinner.spinner():
101+
for thing in range(10):
102+
if thing == 5:
103+
raise CMException("foo")
104+
105+
runner = CliRunner()
106+
result = runner.invoke(cli, [])
107+
assert isinstance(result.exception, CMException)

0 commit comments

Comments
 (0)