Skip to content

Commit 1c1ce47

Browse files
committed
Add Sphinx documentation for the unit tests
Just docstrings on the classes themselves, not the individual tests.
1 parent 5eec813 commit 1c1ce47

File tree

7 files changed

+37
-9
lines changed

7 files changed

+37
-9
lines changed

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# documentation root, use os.path.abspath to make it absolute, like shown here.
2222
# sys.path.insert(0, os.path.abspath('.'))
2323
sys.path.insert(0, os.path.realpath('../'))
24+
sys.path.insert(0, os.path.realpath('../tests/'))
2425

2526
# -- General configuration ------------------------------------------------
2627

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Contents:
1313

1414
pypuppetdbquery
1515
examples
16+
tests
1617

1718
Indices and tables
1819
==================

docs/tests.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Test Suite
2+
==========
3+
4+
.. automodule:: test_frontend
5+
:members:
6+
:undoc-members:
7+
:show-inheritance:
8+
9+
.. automodule:: test_integration
10+
:members:
11+
:undoc-members:
12+
:show-inheritance:
13+
14+
.. automodule:: test_lexer
15+
:members:
16+
:undoc-members:
17+
:show-inheritance:
18+
19+
.. automodule:: test_parser
20+
:members:
21+
:undoc-members:
22+
:show-inheritance:

tests/test_frontend.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,22 @@
2323

2424
class TestFrontend(unittest.TestCase):
2525
"""
26-
Test suite for `pypuppetdbquery.parse`.
26+
Test cases targetting :mod:`pypuppetdbquery`, and particularly
27+
:func:`pypuppetdbquery.parse`.
2728
"""
2829
def _parse(self, s, **kwargs):
29-
return parse(s, parser_opts={
30-
'lex_options': {
30+
return parse(
31+
s,
32+
lex_options={
3133
'debug': False,
3234
'optimize': False,
3335
},
34-
'yacc_options': {
36+
yacc_options={
3537
'debug': False,
3638
'optimize': False,
3739
'write_tables': False,
3840
},
39-
}, **kwargs)
41+
**kwargs)
4042

4143
def test_empty_queries(self):
4244
out = self._parse('')

tests/test_integration.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323

2424
class TestIntegration(unittest.TestCase):
2525
"""
26-
Test suite for the combination of `pypuppetdb.lexer.Lexer`,
27-
`pypuppetdbquery.parser.Parser`, and `pypuppetdb.evaluator.Evaluator`.
26+
Test cases for the integrated combination of
27+
:class:`pypuppetdbquery.lexer.Lexer`,
28+
:class:`pypuppetdbquery.parser.Parser`, and
29+
:class:`pypuppetdbquery.evaluator.Evaluator`.
2830
"""
2931
def setUp(self):
3032
self.parser = Parser(

tests/test_lexer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
class TestLexer(unittest.TestCase):
2424
"""
25-
Test suite for `pypuppetdbquery.lexer.Lexer`.
25+
Test cases for :class:`pypuppetdbquery.lexer.Lexer`.
2626
"""
2727
def setUp(self):
2828
self.lexer = Lexer(

tests/test_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
class TestParster(unittest.TestCase):
2525
"""
26-
Test suite for `pypuppetdbquery.parser.Parser`.
26+
Test cases for :class:`pypuppetdbquery.parser.Parser`.
2727
"""
2828
def setUp(self):
2929
self.parser = Parser(

0 commit comments

Comments
 (0)