<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D">The primary case when you can’t use an object factory is for integration testing, or unit testing code whose purpose is to make queries.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;"> testing-in-python-bounces@lists.idyll.org [mailto:testing-in-python-bounces@lists.idyll.org]
<b>On Behalf Of </b>?????? ?????????<br>
<b>Sent:</b> Tuesday, September 02, 2014 9:58 AM<br>
<b>To:</b> Laszlo Papp<br>
<b>Cc:</b> testing-in-python@lists.idyll.org<br>
<b>Subject:</b> Re: [TIP] pytest: Setup/TearDown with fixtures<o:p></o:p></span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">HI,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">Sorry, maybe my opinion is a kind of oftopic but I think there is no reason to use fixtures at all. Instead of fixtures you should use
<a href="http://factoryboy.readthedocs.org/en/latest/">factory_boy</a>&nbsp;library(or similar).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">As I said it is just IMHO and maybe I miss some scenario when there is no way to avoid fixtures(for example, when you don't use ORM). But I think those cases are rare.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal">--<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Max<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p>&nbsp;</o:p></p>
<div>
<p class="MsoNormal">2014-09-02 16:14 GMT&#43;03:00 Laszlo Papp &lt;<a href="mailto:lpapp@kde.org" target="_blank">lpapp@kde.org</a>&gt;:<o:p></o:p></p>
<p class="MsoNormal">Hi,<br>
<br>
I am sorry about bringing up another frustration with the official<br>
documentation, but ...<br>
<br>
It does not seem simple and easy to write a test class and have setup<br>
and teardown methods with fixtures. The documentation properly<br>
demonstrates a working version of the &quot;old way&quot;; so far so good.<br>
<br>
Yet, I thought being narrow-minded would not be fair, so I gave a try<br>
to the &quot;new way&quot;, but I just failed in every way possible that I have<br>
tried. I found some chunk code snippets on Stack Overflow and in the<br>
official documentation, but they are not good.<br>
<br>
I could not find any dedicated example explaining how to achieve such<br>
a simple use case with the &quot;new shiny way&quot;. I think the documentation<br>
would need some improvement in pytest. I simply cannot get my head<br>
around to this easily, so I just give up for now since I have to<br>
proceed...<br>
<br>
Currently, I am reverting myself to the &quot;old way&quot;, but if you<br>
advertise the &quot;new way&quot; that much, at least give an example for the<br>
generic and common use case (IMHO) that people, including me, have<br>
used in other frameworks and languages. Otherwise, it is just<br>
non-working hype, IMHO. Sorry, I do not like &quot;new shiny ways&quot; that do<br>
not just work.<br>
<br>
Cheers, L.<br>
<br>
_______________________________________________<br>
testing-in-python mailing list<br>
<a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>
<a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><o:p></o:p></p>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<p class="MsoNormal">-- <br>
С уважением,<br>
Максим Харандзюк<o:p></o:p></p>
</div>
</div>
</body>
</html>