Skip to content

Commit 862b7d2

Browse files
committed
Added a development page and modified doctest to automatically
run the doctests of all modules in the intercom package.
1 parent eed456e commit 862b7d2

File tree

3 files changed

+93
-9
lines changed

3 files changed

+93
-9
lines changed

bin/doctest

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,20 @@ import os
55
import site
66
import sys
77

8-
# at least one module must be specified
9-
if len(sys.argv) == 1:
10-
print "No module specified."
11-
128
# calculate the working directory
139
sdir = os.path.abspath(__file__)
1410
wd = os.path.dirname(os.path.dirname(sdir))
1511
site.addsitedir(wd)
1612

13+
# at least one module must be specified
14+
if len(sys.argv) == 1:
15+
glob_pattern = os.path.join(wd, 'intercom', '*.py')
16+
import glob
17+
modules = glob.glob(glob_pattern)
18+
else:
19+
modules = sys.argv[1:]
20+
1721
# for each module
18-
for module_path in sys.argv[1:]:
22+
for module_path in modules:
1923
print "Testing " + module_path
2024
doctest.testfile(module_path, module_relative=False)

docs/development.rst

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
Development
2+
===========
3+
4+
Running the tests
5+
-----------------
6+
7+
Run all of the (nose) tests:
8+
9+
::
10+
11+
nosetests --with-coverage --cover-package=intercom tests
12+
13+
Run the unit tests:
14+
15+
::
16+
17+
nosetests tests -e integration
18+
19+
Run the integration tests (using the dummy `app_id` and `api_key`):
20+
21+
::
22+
23+
nosetests tests -e unit
24+
25+
Doctests
26+
--------
27+
28+
Run all of the doctests:
29+
30+
::
31+
32+
./bin/doctest
33+
34+
Run the doctests in a specific module:
35+
36+
::
37+
38+
./bin/doctest intercom/user.py
39+
40+
Code coverage
41+
-------------
42+
43+
Generate a code coverage report:
44+
45+
::
46+
47+
nosetests --with-coverage --cover-package=intercom tests
48+
Name Stmts Miss Cover Missing
49+
-------------------------------------------------------
50+
intercom 21 0 100%
51+
intercom.impression 25 0 100%
52+
intercom.intercom 85 0 100%
53+
intercom.message_thread 64 0 100%
54+
intercom.user 125 0 100%
55+
-------------------------------------------------------
56+
TOTAL 320 0 100%
57+
-------------------------------------------------------
58+
59+
Pylint
60+
------
61+
62+
Generate a pylint report for a specific module:
63+
64+
::
65+
66+
pylint --rcfile=pylint.conf intercom/user.py
67+
68+
Generate a full pylint report:
69+
70+
::
71+
72+
pylint --rcfile=pylint.conf intercom
73+

docs/index.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ python-intercom
33
===============
44

55
.. toctree::
6-
:hidden:
6+
:hidden:
77

8-
api/modules
9-
installation
10-
changelog
8+
installation
9+
api/modules
10+
changelog
11+
development
1112

1213
Installation
1314
============
@@ -133,6 +134,12 @@ Reply on a Message Thread
133134
thread_id=123,
134135
body="Not much either :(")
135136

137+
Development
138+
===========
139+
140+
Our :doc:`development` page has detailed instructions on how to run our
141+
tests, and to produce coverage and pylint reports.
142+
136143
Changelog
137144
=========
138145

0 commit comments

Comments
 (0)