<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 25/07/2011 13:27, Alfredo Deza wrote:
<blockquote
cite="mid:CAK7CpVGBBjM37E4zxxn+pCg5fb2Yox0zD2W+3QWXkKx0UnTvOw@mail.gmail.com"
type="cite">I think I've always been in happy land when it comes
to naming and other conventions for testing.
<div><br>
</div>
<div>Like prefacing your test files with "test" and placing them
in a "test[s]" directory. There are slight </div>
<div>differences to that, like adding the test[s] module inside
the actual package or not, which is still a rather</div>
<div>acceptable difference.</div>
<div><br>
</div>
<div>And I am completely OK with those slight differences.</div>
<div><br>
</div>
<div>I am currently faced with a Django application that has tests
in a `tests.py` file or a `tests` module that</div>
<div>imports every test class that needs to be tested in
`__init__.py`. I tried looking for test discovery and</div>
<div>auto-discovery in the Django docs but came empty handed [0]</div>
<div><br>
</div>
</blockquote>
<br>
Now that django 1.3 includes unittest2 it *should* be possible to
have test discovery. I haven't looked into it though.<br>
<br>
<blockquote
cite="mid:CAK7CpVGBBjM37E4zxxn+pCg5fb2Yox0zD2W+3QWXkKx0UnTvOw@mail.gmail.com"
type="cite">
<div>The reasoning for the above test structure is because
Django's test runner will look for a tests module and </div>
<div>will run tests found there. If it is a directory, then only
tests that are imported in `__init__.py` will be run.</div>
<div><br>
</div>
<div>Again, no docs that I could find to support that (maybe this
is a *custom* thing in this app?)</div>
<div><br>
</div>
<div>My issue with this, is that it lends to have test files that
are named `feature_foo.py` and not `test_foo.py`.</div>
<div>Which it ends up breaking everything I've been used to until
this moment. </div>
<div><br>
</div>
</blockquote>
<br>
We still name our tests "test_foo.py". I would consider it odd to
not do this.<br>
<br>
<br>
<blockquote
cite="mid:CAK7CpVGBBjM37E4zxxn+pCg5fb2Yox0zD2W+3QWXkKx0UnTvOw@mail.gmail.com"
type="cite">
<div>py.test, nose and I *think* that unittest2 have the same
convention for autodiscovery.</div>
<div><br>
</div>
</blockquote>
Yep (for unittest2).<br>
<br>
Michael<br>
<br>
<blockquote
cite="mid:CAK7CpVGBBjM37E4zxxn+pCg5fb2Yox0zD2W+3QWXkKx0UnTvOw@mail.gmail.com"
type="cite">
<div>
I am not complaining though, but my questions are: </div>
<div><br>
</div>
<div>* Am I wrong to have assumed we had a testing convention?</div>
<div>* Is it just Django that does something like this? Or where
are the docs that state otherwise?</div>
<div><br>
</div>
<div>Feedback/input is greatly appreciated!</div>
<div><br>
</div>
<div><br>
</div>
<div>-Alfredo</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>[0] <a moz-do-not-send="true"
href="https://docs.djangoproject.com/search/?q=test+discovery&release=5">https://docs.djangoproject.com/search/?q=test+discovery&release=5</a></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>
<br>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.voidspace.org.uk/">http://www.voidspace.org.uk/</a>
May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing <a class="moz-txt-link-freetext" href="http://www.sqlite.org/different.html">http://www.sqlite.org/different.html</a>
</pre>
</body>
</html>