File: index.html

package info (click to toggle)
pmock 0.3-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 932 kB
  • ctags: 816
  • sloc: python: 1,674; makefile: 4
file content (65 lines) | stat: -rw-r--r-- 2,168 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<html>

<head>
<title>pMock: a mock object library for Python</title>
</head>

<body>

<h1>pMock</h1>

<p>pMock is a Python module for testing Python code using <a href="http://www.mockobjects.com">mock objects</a>.</p>

<pre>
...
import pmock
...
class InstrumentTest(unittest.TestCase):
    def test_low_quality_analysis(self):
        analyser_mock = pmock.Mock()
        analyser_mock.expects().analyse(pmock.eq("123")).will(pmock.return_value("30"))
        instrument = Instrument(analyser_mock)
        instrument.insert("sample#123")
        self.assert_(instrument.is_low_quality_indicator_on())
        analyser_mock.verify()
...
</pre>

<p>Inspired by the Java <a href="http://www.jmock.org">jMock</a> library, pMock makes the writing of unit tests using mock object techniques easier.</p>

The typical sequence of steps in a test involving pMock mock objects are:

<ul>
<li>Mock objects are created with expectations and simple behaviours</li>
<li>Code under test is called with the mock objects</li>
<li>Code state is asserted as in normal unit tests</li>
<li>The mock objects' expectations are verified (basically another assertion)</li>
</ul>

See the <a href="overview.html">overview</a> for an introduction on how to use pMock in your unit tests.

<h2>Requirements</h2>
<ul>
<li>pMock is currently written for versions of Python >= 2.3</li>
<li>pMock is licensed under the same terms as Python</li>
</ul>

<h2>Download</h2>
<p><a href="http://prdownloads.sourceforge.net/pmock/pmock-0.3.tar.gz?download">pmock 0.3</a></p>

<h2>Documentation</h2>
<ul>
<li><a href="overview.html">Overview</a> of API</li>
<li><a href="api/index.html">API</a> rendered by epydoc</li>
</ul>

<h2>Development</h2>
<p>Sourceforge <a href="http://sourceforge.net/projects/pmock">project page</a></p>
<p>Browse the <a href="http://cvs.sourceforge.net/viewcvs.py/pmock/pmock/src/">source</a> in CVS</p>
<p>Author: Graham Carlyle (grahamcarlyle at users dot sourceforge dot net)
<p>
<a href="http://sourceforge.net"><img src="http://sourceforge.net/sflogo.php?group_id=104082&amp;type=1" width="88" height="31" border="0" alt="SourceForge.net Logo" /></a>
</p>

</body>
</html>