[TIP] Guidelines for where to put tests & how to package them

Olemis Lang olemis at gmail.com
Mon Mar 1 05:32:40 PST 2010


On Sat, Feb 27, 2010 at 2:33 PM, Michael Foord
<fuzzyman at voidspace.org.uk> wrote:
> On 27/02/2010 19:22, C. Titus Brown wrote:
>
[...]
>
> Olemis was confused as to what setuptools did - it does not support a
> callable for the test_suite argument.
>

I was terribly wrong about `suite` and `unittest`, yes, however if
there's something wrong with the following snippet

{{{
#!sh

$ cat setup.py

from setuptools import setup

setup(name='xxx', version='1.0', description='Xxx', package_dir={'xxx'
: ''}, py_modules=['xxx.py'], test_suite='xxx.my_suite')

$ cat xxx.py

def my_suite():
  from unittest import TestCase as TC, TestSuite as TS
  class MyTC(TC):
    def test_fail(self):
      self.fail()
  s = TS()
  s.addTest(MyTC('test_fail'))
  return s

$ python setup.py test
running test
running egg_info
writing xxx.egg-info/PKG-INFO
writing top-level names to xxx.egg-info/top_level.txt
writing dependency_links to xxx.egg-info/dependency_links.txt
package init file '__init__.py' not found (or not a regular file)
file py.py (for module xxx.py) not found
reading manifest file 'xxx.egg-info/SOURCES.txt'
writing manifest file 'xxx.egg-info/SOURCES.txt'
running build_ext
test_fail (xxx.MyTC) ... FAIL

======================================================================
FAIL: test_fail (xxx.MyTC)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/.../temp/xxx.py", line 6, in test_fail
    self.fail()
AssertionError

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (failures=1)
}}}

... then I'm also terribly wrong about setuptool's `test_suite` too ...

CMIIW

-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:
Free calculus 1.3.4 Download - mac software  -
http://feedproxy.google.com/~r/TracGViz-full/~3/O5E_yyBKv0U/



More information about the testing-in-python mailing list