Skip to content

Commit

Permalink
Fix testbook decorator return value (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitsanj authored Aug 12, 2022
1 parent 88fe228 commit e2ae899
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion testbook/testbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def __call__(self, func):
def wrapper(*args, **kwargs): # pragma: no cover
with self.client.setup_kernel():
self._prepare()
func(self.client, *args, **kwargs)
return func(self.client, *args, **kwargs)

wrapper.patchings = [self]
return wrapper
8 changes: 8 additions & 0 deletions testbook/tests/test_testbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,11 @@ def test_testbook_with_notebook_node():

with testbook(nb) as tb:
assert tb.code_cells_executed == 0


def test_function_with_testbook_decorator_returns_value():
@testbook('testbook/tests/resources/inject.ipynb')
def test_function(tb):
return "This should be returned"

assert test_function() == "This should be returned"

0 comments on commit e2ae899

Please sign in to comment.