Nose unable to find tests in ubuntu

前端 未结 7 765
囚心锁ツ
囚心锁ツ 2020-12-02 12:44

Is there any reason why Nose wouldn\'t be able to find tests in Ubuntu 9.04?

I\'m using nose 0.11.1 with python 2.5.4.
I can run tests only if I explicitly spec

7条回答
  •  一整个雨季
    2020-12-02 13:40

    After looking through the source of nose, specifically the selector.py file, if you look at what's happening,

    https://github.com/nose-devs/nose/blob/master/nose/selector.py#L129

    When checking if we wantFile, self.matches is called, which then does a regex search against the match, which is what you would have passed in as testMatch.

    The problem occurs when you then check later down (and, throughout that file),

    https://github.com/nose-devs/nose/blob/master/nose/selector.py#L152

    It runs the very same type of checks again, against wantFunction.

    This means, if you've got a different structure for your package, your container pyfile, and your actual test class / function, you'll have to create a crazy complicated regex to match that at every stage.

    For me, when I learned this, I chose to prefix my package, container and test functions with a common bit, i.e.

    setests ├── __init__.py ├── setest_area1.py └──── def setest_someblock(): ...

    And then my nose command works like,

    nose --testMatch="setest"

    This then filters the way I expect it to work.

提交回复
热议问题