<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=us-ascii" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 25/02/2010 07:03, Robert Collins wrote:
<blockquote cite="mid:1267081404.14435.64.camel@lifeless-64" type="cite">
  <pre wrap="">On Wed, 2010-02-24 at 21:01 -0800, C. Titus Brown wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Hi all,
    </pre>
  </blockquote>
  <pre wrap="">
..
  </pre>
  <blockquote type="cite">
    <pre wrap="">Full source at <a class="moz-txt-link-freetext" href="http://github.com/ctb/SomePackage">http://github.com/ctb/SomePackage</a> or downloadable
at

   <a class="moz-txt-link-freetext" href="http://lyorn.idyll.org/~t/transfer/SomePackage.tar.gz">http://lyorn.idyll.org/~t/transfer/SomePackage.tar.gz</a>

Comments?  Thoughts?  Complaints?  Issues I missed?
    </pre>
  </blockquote>
  <pre wrap="">
The boilerplate 'run' isn't needed.

  </pre>
</blockquote>
<br>
Well - the techniques you discuss below work for unittest based tests,
will they automatically work for doctest tests? What about other test
frameworks?<br>
<br>
The advantage of having a run module that collects and runs the tests
is that it is agnostic of which test runner is used (or at least allows
the *user* to be agnostic, so long as they have the right dependencies
installed anyway).<br>
<br>
<blockquote cite="mid:1267081404.14435.64.camel@lifeless-64" type="cite">
  <pre wrap="">Rather than 'get_suite' define 'test_suite', then
$ trial somepackage.tests will 'just work'
As will
#actually, there is a bug open on this one:
$ python -m unittest somepackage.tests.test_suite
  </pre>
</blockquote>
That bug is rejected:<br>
<br>
&nbsp;&nbsp;&nbsp; <a class="moz-txt-link-freetext" href="http://bugs.python.org/issue7501">http://bugs.python.org/issue7501</a><br>
<br>
With the new unittest functionality (or unittest2 or the discover
module) the correct way to do this is to define load_tests and do:<br>
<br>
&nbsp;&nbsp;&nbsp; python -m unittest somepackage.tests.module_name<br>
&nbsp;&nbsp;&nbsp; python -m unittest discover<br>
<br>
Instead of module_name you can use the name of a suite or class or even
individual test method.<br>
<br>
Info on load_tests:<br>
<br>
&nbsp;&nbsp;&nbsp; <a class="moz-txt-link-freetext" href="http://docs.python.org/dev/library/unittest.html#load-tests-protocol">http://docs.python.org/dev/library/unittest.html#load-tests-protocol</a><br>
<blockquote cite="mid:1267081404.14435.64.camel@lifeless-64" type="cite">
  <pre wrap=""># but this works:
$ python -m subunit.run somepackage.tests.test_suite
$ python -m testtools.run somepackage.tests.test_suite

If instead you define the load_tests hook, python 2.7 and 3.1 will work
with
$ python -m unittest somepackage   # discovery ftw

In older pythons the discover module can do this for you as well, I
don't know its command line interface tough.
  </pre>
</blockquote>
<br>
The discover module has the same command line interface for test
discovery as unittest2 and the new unittest. The exception is that the
'discover' subcommand is unneeded as test discovery is all that the
discover module does.<br>
<br>
More on the discover module (and its command line options) at:<br>
<br>
&nbsp;&nbsp;&nbsp; <a class="moz-txt-link-freetext" href="http://pypi.python.org/pypi/discover">http://pypi.python.org/pypi/discover</a><br>
<br>
All the best,<br>
<br>
Michael<br>
<br>
<blockquote cite="mid:1267081404.14435.64.camel@lifeless-64" type="cite">
  <pre wrap="">
Cheers,
Rob
  </pre>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
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.ironpythoninaction.com/">http://www.ironpythoninaction.com/</a>
<a class="moz-txt-link-freetext" href="http://www.voidspace.org.uk/blog">http://www.voidspace.org.uk/blog</a>

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (&#8221;BOGUS AGREEMENTS&#8221;) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.

</pre>
</body>
</html>