summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Piercy <web@stevepiercy.com>2016-07-03 17:10:36 -0700
committerSteve Piercy <web@stevepiercy.com>2016-07-03 17:10:36 -0700
commit2612de2f38094f3c04ebf991f1ca84b02bf5ae3f (patch)
treed953c458d7193ae7edf17d28547080d4b805a680
parent384d78a75237ccb98fc7e01e2998a723d03dd455 (diff)
downloadpyramid-2612de2f38094f3c04ebf991f1ca84b02bf5ae3f.tar.gz
pyramid-2612de2f38094f3c04ebf991f1ca84b02bf5ae3f.tar.bz2
pyramid-2612de2f38094f3c04ebf991f1ca84b02bf5ae3f.zip
Show testsetup code in rendered docs.
For `testsetup`, Sphinx does not show code in the output: http://www.sphinx-doc.org/en/stable/ext/doctest.html#directive-testsetup This commit fixes that issue, although duplicates code. I'll submit a feature request to https://github.com/sphinx-doc/sphinx/ Fixes #2670
-rw-r--r--pyramid/decorator.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/pyramid/decorator.py b/pyramid/decorator.py
index ea518bfcb..e3a8c707f 100644
--- a/pyramid/decorator.py
+++ b/pyramid/decorator.py
@@ -8,6 +8,16 @@ class reify(object):
replacing the function it decorates with an instance variable. It is, in
Python parlance, a non-data descriptor. An example:
+ .. code-block:: python
+
+ from pyramid.decorator import reify
+
+ class Foo(object):
+ @reify
+ def jammy(self):
+ print('jammy called')
+ return 1
+
.. testsetup::
from pyramid.decorator import reify