File: changelog.html

package info (click to toggle)
python-mock 0.6.0-1.1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 780 kB
  • ctags: 245
  • sloc: python: 755; makefile: 28
file content (211 lines) | stat: -rw-r--r-- 11,514 bytes parent folder | download
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>CHANGELOG &mdash; Mock v0.6.0 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.6.0',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="Mock v0.6.0 documentation" href="index.html" />
    <link rel="prev" title="TODO and Limitations" href="todo.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="todo.html" title="TODO and Limitations"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">Mock v0.6.0 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="changelog">
<h1>CHANGELOG<a class="headerlink" href="#changelog" title="Permalink to this headline">¶</a></h1>
<div class="section" id="version-0-6-0">
<h2>2009/08/22 Version 0.6.0<a class="headerlink" href="#version-0-6-0" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li>New test layout compatible with test discovery</li>
<li>Decriptors (static methods / class methods etc) can now be patched and
restored correctly</li>
<li>Mocks can raise exceptions when called by setting <tt class="docutils literal"><span class="pre">side_effect</span></tt> to an
exception class or instance.</li>
<li>Mocks that wrap objects will not pass on calls to the underlying object if
an explicit return_value is set.</li>
</ul>
</div>
<div class="section" id="version-0-5-0">
<h2>2009/04/17 Version 0.5.0<a class="headerlink" href="#version-0-5-0" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li>Made DEFAULT part of the public api.</li>
<li>Documentation built with Sphinx.</li>
<li><tt class="docutils literal"><span class="pre">side_effect</span></tt> is now called with the same arguments as the mock is called with and
if returns a non-DEFAULT value that is automatically set as the <tt class="docutils literal"><span class="pre">mock.return_value</span></tt>.</li>
<li><tt class="docutils literal"><span class="pre">wraps</span></tt> keyword argument used for wrapping objects (and passing calls through to the wrapped object).</li>
<li><tt class="docutils literal"><span class="pre">Mock.reset</span></tt> renamed to <tt class="docutils literal"><span class="pre">Mock.reset_mock</span></tt>, as reset is a common API name.</li>
<li><tt class="docutils literal"><span class="pre">patch</span></tt> / <tt class="docutils literal"><span class="pre">patch_object</span></tt> are now context managers and can be used with <tt class="docutils literal"><span class="pre">with</span></tt>.</li>
<li>A new &#8216;create&#8217; keyword argument to patch and patch_object that allows them to patch
(and unpatch) attributes that don&#8217;t exist. (Potentially unsafe to use - it can allow
you to have tests that pass when they are testing an API that doesn&#8217;t exist - use at
your own risk!)</li>
<li>The methods keyword argument to Mock has been removed and merged with spec. The spec
argument can now be a list of methods or an object to take the spec from.</li>
<li>Nested patches may now be applied in a different order (created mocks passed
in the opposite order). This is actually a bugfix.</li>
<li>patch and patch_object now take a spec keyword argument. If spec is
passed in as &#8216;True&#8217; then the Mock created will take the object it is replacing
as its spec object. If the object being replaced is a class, then the return
value for the mock will also use the class as a spec.</li>
<li>A Mock created without a spec will not attempt to mock any magic methods / attributes
(they will raise an <tt class="docutils literal"><span class="pre">AttributeError</span></tt> instead).</li>
</ul>
</div>
<div class="section" id="version-0-4-0">
<h2>2008/10/12 Version 0.4.0<a class="headerlink" href="#version-0-4-0" title="Permalink to this headline">¶</a></h2>
<ul>
<li><p class="first">Default return value is now a new mock rather than None</p>
</li>
<li><p class="first">return_value added as a keyword argument to the constructor</p>
</li>
<li><p class="first">New method &#8216;assert_called_with&#8217;</p>
</li>
<li><p class="first">Added &#8216;side_effect&#8217; attribute / keyword argument called when mock is called</p>
</li>
<li><p class="first">patch decorator split into two decorators:</p>
<blockquote>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">patch_object</span></tt> which takes an object and an attribute name to patch
(plus optionally a value to patch with which defaults to a mock object)</li>
<li><tt class="docutils literal"><span class="pre">patch</span></tt> which takes a string specifying a target to patch; in the form
&#8216;package.module.Class.attribute&#8217;. (plus optionally a value to
patch with which defaults to a mock object)</li>
</ul>
</blockquote>
</li>
<li><p class="first">Can now patch objects with <tt class="xref docutils literal"><span class="pre">None</span></tt></p>
</li>
<li><p class="first">Change to patch for nose compatibility with error reporting in wrapped functions</p>
</li>
<li><p class="first">Reset no longer clears children / return value etc - it just resets
call count and call args. It also calls reset on all children (and
the return value if it is a mock).</p>
</li>
</ul>
<p>Thanks to Konrad Delong, Kevin Dangoor and others for patches and suggestions.</p>
</div>
<div class="section" id="version-0-3-1">
<h2>2007/12/03  Version 0.3.1<a class="headerlink" href="#version-0-3-1" title="Permalink to this headline">¶</a></h2>
<p><tt class="docutils literal"><span class="pre">patch</span></tt> maintains the name of decorated functions for compatibility with nose
test autodiscovery.</p>
<p>Tests decorated with <tt class="docutils literal"><span class="pre">patch</span></tt> that use the two argument form (implicit mock
creation) will receive the mock(s) passed in as extra arguments.</p>
<p>Thanks to Kevin Dangoor for these changes.</p>
</div>
<div class="section" id="version-0-3-0">
<h2>2007/11/30  Version 0.3.0<a class="headerlink" href="#version-0-3-0" title="Permalink to this headline">¶</a></h2>
<p>Removed <tt class="docutils literal"><span class="pre">patch_module</span></tt>. <tt class="docutils literal"><span class="pre">patch</span></tt> can now take a string as the first argument for patching modules.</p>
<p>The third argument to <tt class="docutils literal"><span class="pre">patch</span></tt> is optional - a mock will be created by default if it is not passed in.</p>
</div>
<div class="section" id="version-0-2-1">
<h2>2007/11/21  Version 0.2.1<a class="headerlink" href="#version-0-2-1" title="Permalink to this headline">¶</a></h2>
<p>Bug fix, allows reuse of functions decorated with <tt class="docutils literal"><span class="pre">patch</span></tt> and <tt class="docutils literal"><span class="pre">patch_module</span></tt>.</p>
</div>
<div class="section" id="version-0-2-0">
<h2>2007/11/20  Version 0.2.0<a class="headerlink" href="#version-0-2-0" title="Permalink to this headline">¶</a></h2>
<p>Added <tt class="docutils literal"><span class="pre">spec</span></tt> keyword argument for creating <tt class="docutils literal"><span class="pre">Mock</span></tt> objects from a specification object.</p>
<p>Added <tt class="docutils literal"><span class="pre">patch</span></tt> and <tt class="docutils literal"><span class="pre">patch_module</span></tt> monkey patching decorators.</p>
<p>Added <tt class="docutils literal"><span class="pre">sentinel</span></tt> for convenient access to unique objects.</p>
<p>Distribution includes unit tests.</p>
</div>
<div class="section" id="version-0-1-0">
<h2>2007/11/19  Version 0.1.0<a class="headerlink" href="#version-0-1-0" title="Permalink to this headline">¶</a></h2>
<p>Initial release.</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="index.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="">CHANGELOG</a><ul>
<li><a class="reference external" href="#version-0-6-0">2009/08/22 Version 0.6.0</a></li>
<li><a class="reference external" href="#version-0-5-0">2009/04/17 Version 0.5.0</a></li>
<li><a class="reference external" href="#version-0-4-0">2008/10/12 Version 0.4.0</a></li>
<li><a class="reference external" href="#version-0-3-1">2007/12/03  Version 0.3.1</a></li>
<li><a class="reference external" href="#version-0-3-0">2007/11/30  Version 0.3.0</a></li>
<li><a class="reference external" href="#version-0-2-1">2007/11/21  Version 0.2.1</a></li>
<li><a class="reference external" href="#version-0-2-0">2007/11/20  Version 0.2.0</a></li>
<li><a class="reference external" href="#version-0-1-0">2007/11/19  Version 0.1.0</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="todo.html"
                                  title="previous chapter">TODO and Limitations</a></p>
            <h3>This Page</h3>
            <ul class="this-page-menu">
              <li><a href="_sources/changelog.txt"
                     rel="nofollow">Show Source</a></li>
            </ul>
          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="todo.html" title="TODO and Limitations"
             >previous</a> |</li>
        <li><a href="index.html">Mock v0.6.0 documentation</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
      &copy; Copyright 2009, Michael Foord.
      Last updated on Aug 22, 2009.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.1.
    </div>
  </body>
</html>