New submission from danosaure <danosa...@gmail.com>:

I cannot run the simpliest test because issubclass() is always returning False 
in unittest.py

If i follow the documentation, the following should work.

    python -m unittest simple_test

It finds 0 tests because in unittest.py, in the following line:

            if (isinstance(obj, (type, types.ClassType)) and
                issubclass(obj, TestCase)):
                tests.append(self.loadTestsFromTestCase(obj))

and "issubclass()" always return False. The cause is "unittest" module is 
loaded twice. If I modify "unittest.py" to add "print", it pass in my test 
module and check my "class A(unittest.TestCase)".

Obviously, if I do the check interactively, it will return True.

Is there a problem with the "python -m unittest module" syntax? It seems to 
have two namespaces.

----------
components: Tests
files: simple_test.py
messages: 118035
nosy: Danosaure
priority: normal
severity: normal
status: open
title: can't run unittest because of issubclass
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file19136/simple_test.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10033>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to