<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">We have a policy of always having a
.testing_create() classmethod on each entity object which is
responsible for creating the object with whatever data is needed
to satisfy database constraints. That would include and dependent
objects, as needed.<br>
<br>
So, if I need an Order entity for testing, in the test, I'm only
responsible for:<br>
<br>
# delete all orders and anything dependent on orders, this method
is responsible for knowing what depends on orders and calling
dependent_object.delete_all_cascaded() for those tables. But only
one level deep since the dependent objects are also responsible
for taking care of dependencies.<br>
<br>
Orders.delete_all_cascaded() <br>
<br>
I always delete all objects when beginning a test to avoid
cross-test contamination.<br>
<br>
# create order with sane defaults, pass in parameters to change
values that need to be updated for testing.<br>
Orders.testing_create(...)<br>
<br>
FWIW. :)<br>
<div class="moz-signature"><br>
<b>Randy Syring</b><br>
<small>Husband | Father | Redeemed Sinner</small><br>
<br>
<i><small>"For what does it profit a man to gain the whole world<br>
and forfeit his soul?" (Mark 8:36 ESV)</small></i>
<br>
<br>
</div>
On 07/03/2014 07:48 AM, Marcin Tustin wrote:<br>
</div>
<blockquote
cite="mid:00BB772A2997564C8A33493B6E389CDA6E20E1@NHPDAG002.dt.inc"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
<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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-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-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.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]-->
<div class="WordSection1">
<p class="MsoNormal">Hi All,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Right now I’m looking for alternatives to
the farmdev fixture module (<a moz-do-not-send="true"
href="http://farmdev.com/projects/fixture/">http://farmdev.com/projects/fixture/</a>)
for loading fixture data with sqlalchemy. My main problem with
that library is that while it’s easy to use (nice,
human-editable way of specifying fixtures), the teardown code
in particular is rather buggy (among other issues, it will
issue deletes twice for each row, the second time with some
data as strings where they were ints before).
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">What are you using, and why do you like or
dislike it?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Marcin<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<table class="MsoNormalTable" style="width:237.75pt" width="396"
border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="padding:0in 0in 0in 0in">
<p class="MsoNormal"><b><span
style="font-size:9.0pt;font-family:"Arial","sans-serif";color:#666666">Marcin
Tustin</span></b><span
style="font-size:8.5pt;font-family:"Arial","sans-serif";color:#666666"><br>
Senior Software Engineer<o:p></o:p></span></p>
<div>
<div>
<div class="MsoNormal"><span
style="font-size:8.5pt;font-family:"Arial","sans-serif";color:#666666">
<hr style="width:1.5in" size="2" width="180"
align="left">
</span></div>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span
style="font-size:8.5pt;font-family:"Arial","sans-serif";color:#666666"><br>
1111 Marcus Avenue<br>
Lake Success, NY 11042<br>
<a moz-do-not-send="true"
href="https://www.dealertrack.com/"><span
style="color:#00549F">dealertrack.com</span></a><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:8.5pt;font-family:"Arial","sans-serif";color:#666666">p
</span><span
style="font-size:8.5pt;font-family:"Arial","sans-serif";color:#666666">516.300.7072</span><span
style="font-size:8.5pt;font-family:"Arial","sans-serif";color:#666666"><o:p></o:p></span></p>
<p class="MsoNormal"><span
style="font-size:8.5pt;font-family:"Arial","sans-serif";color:#666666"><br>
</span><b><span
style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#5E6167">dealertrack </span></b><b><span
style="font-size:10.5pt;font-family:"Arial","sans-serif";color:#999B98">technologies</span></b><span
style="font-size:7.5pt;font-family:"Arial","sans-serif";color:#999B98">™</span><span
style="font-size:8.5pt;font-family:"Arial","sans-serif";color:#666666"><br>
<br>
</span><span
style="font-size:6.0pt;font-family:"Arial","sans-serif";color:#999B98">Confidentiality
Notice: This e-mail and any attachments may contain
confidential, proprietary information of Dealertrack
Technologies. It is intended solely for the named
recipient(s) listed above and should be maintained in
strictest confidence. If you are not the intended recipient,
you are hereby notified that any disclosure, copying,
distribution, or use of the information contained herein
(including any reliance thereon) is STRICTLY PROHIBITED. If
you have received this e-mail in error, please immediately
notify the sender and delete this information from your
computer and destroy any related paper copies. Unless
otherwise expressly stated in the text of the e-mail, the
addition of a typed name or initials to this e-mail does not
(i) evidence an intent to sign the e-mail or (ii) constitute
either (a) a signature or (b) consent to use electronic
records or signatures in place of a writing or a handwritten
signature</span><span style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
testing-in-python mailing list
<a class="moz-txt-link-abbreviated" href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a>
<a class="moz-txt-link-freetext" href="http://lists.idyll.org/listinfo/testing-in-python">http://lists.idyll.org/listinfo/testing-in-python</a>
</pre>
</blockquote>
<br>
</body>
</html>