nose-devs / nose

nose is nicer testing for python
http://readthedocs.org/docs/nose/en/latest/
1.36k stars 395 forks source link

xunit classname does not show the full path to the class #1079

Closed earonesty closed 6 years ago

earonesty commented 6 years ago
        <testcase classname="path_to_test_suite.TestSomething"
                  name="test_it" time="0">
            <error type="exceptions.TypeError" message="oops, wrong type">
            Traceback (most recent call last):
            ...
            TypeError: oops, wrong type
            </error>
        </testcase>

the "path_to_test_suite" is not actually the path. It's a "one level deep path", so a test that's located here: src/test/foo/bar.py:TestBar ... will just be bar.TestBar.... with no mention of others.

In this way you're not sure which test bar.TestBar is ... if there are multiple tests with the same classname ... which might certainly be the case in projects with a factory structure.

earonesty commented 6 years ago

OK, This was sort of my error. Nose is capable of discovering modules when index.py is not present (src.foo.bar) ... but if there is no index.py, it will report as just bar ... adding index.py fixes this.