Skip to content
This repository was archived by the owner on Nov 8, 2020. It is now read-only.

Commit f4bbed0

Browse files
authored
Merge pull request #13 from jnikula/with-app-return-value
Return the wrapped function's result from @with_app decorator
2 parents edc6cde + f24f9fd commit f4bbed0

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/sphinx_testing/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def decorator(*args, **kwargs):
159159
app = TestApp(*self.sphinxargs, **sphinxkwargs)
160160
self.write_docstring(app, func.__doc__)
161161

162-
func(*(args + (app, status, warning)), **kwargs)
162+
return func(*(args + (app, status, warning)), **kwargs)
163163
except Exception as _exc:
164164
exc = _exc
165165
raise

tests/test_util.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,12 @@ def execute(app, status, warning):
190190
self.assertEqual('Hello world ', content)
191191

192192
execute()
193+
194+
def test_with_app_return_value(self):
195+
@with_app(create_new_srcdir=True)
196+
def execute(ret, app, status, warning):
197+
return ret
198+
199+
s = 'What goes in, must come out'
200+
201+
self.assertEqual(execute(s), s)

0 commit comments

Comments
 (0)