Skip to content

Commit bcfbf06

Browse files
committed
Add doctest in documentation
1 parent c330039 commit bcfbf06

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ deploy:
2222
local-dir: .tox/docs/_build
2323
on:
2424
tags: true
25-
condition: $TOX = docs
25+
condition: $TOX = "docs"

docs/index.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
.. include:: ../README.rst
22

3-
Content
4-
-------
5-
63
.. testsetup::
74

85
from foo import foo
96

7+
Doctest in the documentation
8+
----------------------------
9+
10+
>>> foo('dummy')
11+
'foo'
12+
13+
14+
Content
15+
-------
16+
17+
1018
.. automodule:: foo
1119
:members:
1220
:show-inheritance:

foo/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def foo(dummy):
1111
Examples should be written in doctest format, and should illustrate how
1212
to use the function.
1313
14-
>>> print(foo('dummy'))
15-
foo
14+
>>> foo('dummy')
15+
'foo'
1616
1717
Note:
1818
Test note in docstring

tox.ini

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,19 @@ deps =
1515
-rrequirements.txt
1616
-rtests/requirements.txt
1717

18-
commands=
19-
py.test --verbose \
20-
--cov {envsitepackagesdir}/foo --cov-report term-missing --cov-report html \
18+
commands =
19+
py.test \
20+
--cov {envsitepackagesdir}/foo \
21+
--cov-report term-missing \
22+
--verbose \
2123
{posargs}
2224

2325
[testenv:py36-docs]
2426
deps =
2527
-rdocs/requirements.txt
2628

27-
commands =
29+
commands =
30+
sphinx-build docs "{toxworkdir}/docs/_build" --color -W -bhtml {posargs}
2831
sphinx-build docs "{toxworkdir}/docs/_build" --color -W -bdoctest {posargs}
2932
sphinx-build docs "{toxworkdir}/docs/_build" --color -W -bcoverage {posargs}
30-
/bin/cat {toxworkdir}/docs/_build/python.txt
31-
sphinx-build docs "{toxworkdir}/docs/_build" --color -W -bhtml {posargs}
33+
/bin/cat {toxworkdir}/docs/_build/python.txt

0 commit comments

Comments
 (0)