Issue 10033: can't run unittest because of issubclass (original) (raw)

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.