Skip to content

Commit e2ae899

Browse files
authored
Fix testbook decorator return value (#145)
1 parent 88fe228 commit e2ae899

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

testbook/testbook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def __call__(self, func):
6060
def wrapper(*args, **kwargs): # pragma: no cover
6161
with self.client.setup_kernel():
6262
self._prepare()
63-
func(self.client, *args, **kwargs)
63+
return func(self.client, *args, **kwargs)
6464

6565
wrapper.patchings = [self]
6666
return wrapper

testbook/tests/test_testbook.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,11 @@ def test_testbook_with_notebook_node():
6868

6969
with testbook(nb) as tb:
7070
assert tb.code_cells_executed == 0
71+
72+
73+
def test_function_with_testbook_decorator_returns_value():
74+
@testbook('testbook/tests/resources/inject.ipynb')
75+
def test_function(tb):
76+
return "This should be returned"
77+
78+
assert test_function() == "This should be returned"

0 commit comments

Comments
 (0)