<meta charset="utf-8">Bah, forgot to include TiP in the reply.<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Alfredo Deza</b> <br>Date: Sat, Feb 12, 2011 at 4:18 PM<br>

Subject: Re: [TIP] running away from RSpec<br>To: &quot;vanderson.mota&quot;<br><br><br><br><div class="gmail_quote"><div class="im">On Sat, Feb 12, 2011 at 2:36 PM, <a href="mailto:vanderson.mota@gmail.com" target="_blank">vanderson.mota@gmail.com</a> <span dir="ltr">&lt;<a href="mailto:vanderson.mota@gmail.com" target="_blank">vanderson.mota@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>&gt; Probably the most common (and understandable) answer is that Python syntax<br>
&gt; wouldn&#39;t allow such a thing<br>
&gt; whereas in Ruby it is possible.<br>
<br>
</div>not syntax exactly. Rspec monkeypatches every object inside of its<br>
scope, inserting the methods &quot;should&quot; and &quot;should_not&quot;. You can do<br>
something in python, but you can&#39;t monkeypatch the built-in types.<br>
<br>
If you want something like rspec, there is should_dsl.<br>
<a href="https://github.com/hugobr/should-dsl" target="_blank">https://github.com/hugobr/should-dsl</a></blockquote><div><br></div></div><div>I think that implementation is awful :(</div><div><br></div><div>Writing ``|should|`` doesn&#39;t look at all right to me.  </div>

<div><div></div><div class="h5">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<div><br>
&gt; This more of an open question I guess, but why there isn&#39;t a project in<br>
&gt; Python that grabs the best features from RSpec<br>
&gt; and implements them?<br>
<br>
</div>I don&#39;t see a HUGE advantage in using &quot;value.should be_true&quot; instead<br>
of assertTrue(value). It&#39;s a matter of taste.<br>
<br>
The thing i like in Rspec is that you can have subcontexts in your<br>
tests/specs, like this:<br>
<br>
describe &quot;login&quot; do<br>
<br>
  ..code..<br>
<br>
   context &quot;success&quot; do<br>
     ....code...<br>
   end<br>
<br>
   context &quot;failure&quot; do<br>
     ...code...<br>
   end<br>
end<br>
<br>
It makes easier to keep your tests more organized. You can achieve<br>
such organization with unittest/unittest2, but will require a little<br>
more work.<br>
The only thing i would like in unittest is if the asserts were<br>
functions instead of methods. But this is a &quot;nice-to-have&quot;. I can live<br>
with asserts as methods.<br>
<br>
Talking about the Rspec mocks:<br>
<br>
I don&#39;t like all that names... mocks, stubs... etc. I prefer to use<br>
mock.py, because it&#39;s much more simpler, IMHO.<br>
<br>
The only thing i think its a mistake is it to try to make a testing<br>
tool that looks like Ruby. </blockquote><div><br></div></div></div><div>My intent was not to imply something like that, I&#39;m more towards &quot;if language A is doing something</div><div>awesome for testing, why can&#39;t Python do/have something similar (better!)</div>

<div class="im">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The better ports happen when you apply the<br>
most intention than implementation. The RSpec makes tests easier to<br>
write and maintain, in &quot;ruby world&quot;. And works pretty well.<br>
<br>
Python have such projects, like nose, pytest, etc and they&#39;re doing<br>
quite a good job.<br>
<br></blockquote></div><div>py.test is absolutely awesome and is what I use day in and day out, but this</div><div>is totally different from discussing the possibility of a Python RSpec project/implementation. </div><div>

<div></div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
Which features you like in Rspec, despite teaching english to the<br>
interpreter? ;-p<br>
<br>
<br>
Cheers!<br>
<br>
2011/2/12 Alfredo Deza &lt;<a href="mailto:alfredodeza@gmail.com" target="_blank">alfredodeza@gmail.com</a>&gt;<br>
<div><div></div><div>&gt; For the past few weeks I have been thinking a lot about RSpec and why there<br>
&gt; is no clear, definite answer when<br>
&gt; someone asks:<br>
&gt;  &quot;I&#39;m looking for a Python equivalent of RSpec. Where can I find such a<br>
&gt; thing?&quot;<br>
&gt; Probably the most common (and understandable) answer is that Python syntax<br>
&gt; wouldn&#39;t allow such a thing<br>
&gt; whereas in Ruby it is possible.<br>
&gt; Ok, if that is so, then why there are so many projects (most of them already<br>
&gt; un-maintained) that try to give<br>
&gt; some RSpec features to Python?<br>
&gt; There is Pinocchio written in part by Titus (last commit was in 2009), there<br>
&gt; is a spec runner that Gary wrote, there is also<br>
&gt; pyspec (last version from 2008) and a couple of others. I know there is<br>
&gt; &quot;lettuce&quot; which tries to emulate Ruby&#39;s Cucumber<br>
&gt; but that is not exactly RSpec.<br>
&gt; So are we running away from RSpec just because we can&#39;t implement it in<br>
&gt; Python? (or maybe we do want to implement it<br>
&gt; and then we fail?).<br>
&gt; This more of an open question I guess, but why there isn&#39;t a project in<br>
&gt; Python that grabs the best features from RSpec<br>
&gt; and implements them?<br>
&gt; Isn&#39;t that how we came about UnitTesting? (e.g. &quot;hey that&#39;s JUnit and seems<br>
&gt; good let&#39;s implement that in Python&quot;)<br>
&gt; Not trying to start a flamewar here, but I guess at some level it is healthy<br>
&gt; to ask these kind of questions, specially since<br>
&gt; a lot of the guys in this list are so important for the Python testing<br>
&gt; environment.<br>
&gt;<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; testing-in-python mailing list<br>
&gt; <a href="mailto:testing-in-python@lists.idyll.org" target="_blank">testing-in-python@lists.idyll.org</a><br>
&gt; <a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
&gt;<br>
&gt;<br>
<font color="#888888"><br>
<br>
<br>
--<br>
Vanderson Mota dos Santos<br>
</font></blockquote></div></div></div><br>
</div><br>