Python unittest issue
Question: I have a unittest script in a 'tests' directory which I execute like: $
python3 -m unittest mainmodule.tests,

the entire class is a super simple one, has an assertEquals(1, 1), the script
runs, but it says: 0 tests ran in 0.000 seconds .... OK.

No matter how I run the script (from console or via itnerpreter etc).

I'm using python 3.1.2

Ideas?

Edit: the method starts with 'test'.


Answer: I guess your package structure should be something like this:

    
    
    $ tree mainmodule
    mainmodule/
    |--__init__.py
    |--file1.py
    |--file2.py
    |--tests
    |  |--__init__.py
    |  |--test_file1.py
    

In which case you should run:

    
    
    $ python3 -m unittest mainmodule.tests.test_file1
    

or simply:

    
    
    $ python3 -m unittest
    

and see what output comes out.

**Note:**  
If you're not using relative imports in your test file, you can always add at
the end of it something like:

    
    
    if __name__ == '__main__':
        unittest.main()
    

and then run `$ python3 test_file1.py` to test your code.

See the [unittest
documentation](http://docs.python.org/release/3.1.2/library/unittest.html) for
examples.

