Most viewed recipes tagged "unittest"http://code.activestate.com/recipes/tags/unittest/views/2017-06-13T18:54:02-07:00ActiveState Code RecipesPython Unittest - Obtain the results of all the tests run as a list (Python)
2014-04-24T08:52:32-07:00Cosmin Niculaehttp://code.activestate.com/recipes/users/4189842/http://code.activestate.com/recipes/578866-python-unittest-obtain-the-results-of-all-the-test/
<p style="color: grey">
Python
recipe 578866
by <a href="/recipes/users/4189842/">Cosmin Niculae</a>
(<a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/run/">run</a>, <a href="/recipes/tags/tests/">tests</a>, <a href="/recipes/tags/unittest/">unittest</a>).
Revision 2.
</p>
<p>So far, there is no way of returning the results of the tests run with unittest in any form, except for having the results printed. The purpose of this code is to have the name of the test cases, their indexes, as well as the results (Pass, Fail, Error) as a list. This is extremely used when you want to create a table with the results, as it has all the information needed. </p>
<p>The affected file is the result.py in the unittest library folder.</p>
Using Tkinter's Invoke Method for testing (Python)
2017-06-13T18:54:02-07:00Stephen Rigdenhttp://code.activestate.com/recipes/users/4191139/http://code.activestate.com/recipes/578978-using-tkinters-invoke-method-for-testing/
<p style="color: grey">
Python
recipe 578978
by <a href="/recipes/users/4191139/">Stephen Rigden</a>
(<a href="/recipes/tags/invoke/">invoke</a>, <a href="/recipes/tags/mainloop/">mainloop</a>, <a href="/recipes/tags/tkinter/">tkinter</a>, <a href="/recipes/tags/ttk/">ttk</a>, <a href="/recipes/tags/unittest/">unittest</a>, <a href="/recipes/tags/unittests/">unittests</a>).
</p>
<p>This recipe shows a skeleton unittest fixture that calls a widget's command using <code>invoke</code> without starting tkinter's mainloop. (Tcl8.6.3/Tk8.6.3.)</p>
Robust Testing of Tkinter Menu Items with Mocking. (Python)
2017-06-13T18:44:58-07:00Stephen Rigdenhttp://code.activestate.com/recipes/users/4191139/http://code.activestate.com/recipes/578964-robust-testing-of-tkinter-menu-items-with-mocking/
<p style="color: grey">
Python
recipe 578964
by <a href="/recipes/users/4191139/">Stephen Rigden</a>
(<a href="/recipes/tags/invoke/">invoke</a>, <a href="/recipes/tags/mainloop/">mainloop</a>, <a href="/recipes/tags/mock/">mock</a>, <a href="/recipes/tags/mocking/">mocking</a>, <a href="/recipes/tags/tk/">tk</a>, <a href="/recipes/tags/tkinter/">tkinter</a>, <a href="/recipes/tags/unittest/">unittest</a>, <a href="/recipes/tags/unittesting/">unittesting</a>, <a href="/recipes/tags/unittests/">unittests</a>).
Revision 7.
</p>
<p>This recipe addresses the problems encountered when building robust tests for Tk menus.
The software under test is a simple window with two menu items that each invoke a one button dialog box. All user visible text is imported from an external config.ini file.
This scenario can lead to fragile test code because of the way TK's invoke(index) command has been implemented. (Tcl8.6.3/Tk8.6.3.)</p>
@unittest.skip_others decorator (Python)
2012-08-06T02:20:19-07:00Giampaolo RodolĂ http://code.activestate.com/recipes/users/4178764/http://code.activestate.com/recipes/578234-unittestskip_others-decorator/
<p style="color: grey">
Python
recipe 578234
by <a href="/recipes/users/4178764/">Giampaolo RodolĂ </a>
(<a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/python3/">python3</a>, <a href="/recipes/tags/skip/">skip</a>, <a href="/recipes/tags/unittest/">unittest</a>).
Revision 3.
</p>
<p>Decorator which skips all tests except the one decorated with it.
Based on original proposal on python-ideas:
<a href="http://mail.python.org/pipermail/python-ideas/2010-August/007992.html" rel="nofollow">http://mail.python.org/pipermail/python-ideas/2010-August/007992.html</a></p>
simple recurse class (Python)
2008-08-26T01:29:22-07:00alexander bakerhttp://code.activestate.com/recipes/users/4166679/http://code.activestate.com/recipes/576449-simple-recurse-class/
<p style="color: grey">
Python
recipe 576449
by <a href="/recipes/users/4166679/">alexander baker</a>
(<a href="/recipes/tags/recurse/">recurse</a>, <a href="/recipes/tags/unittest/">unittest</a>).
Revision 2.
</p>
<h4>Class to encapsualte building a file</h4>
<h4>from a path</h4>