LoginSignup
4
4

More than 5 years have passed since last update.

nosetestsが何故か再帰でテストケースを探してくれない?

Last updated at Posted at 2012-09-29

macportsでインストールしたnoseについているnosetests-2.7が何故かテストケースを再帰的に探してくれない?

ProjectRoot/
    src/
        test/
            __init__.py
            module_name/
                __init__.py
src/test/__init__.py
""" test sample
"""
from nose.core import unittest

class MainTest(unittest.TestCase):
    def test_sample(self):
        "set up test fixtures"

src/test/module_name/__init__.py
""" unittest for module
"""
# -*- coding: utf-8 -*-
from nose.core import unittest

class SampleTest(unittest.TestCase):
    def test_sample(self):
        self.fail('sss')

で、やってみた

>Project_Root $ nosetests-2.7 -v  src/test 
set up test fixtures ... ok

----------------------------------------------------------------------
Ran 1 test in 0.001s

OK

あれ?これだけ?

>Project_Root $ nosetests-2.7 -v  src/test/*
set up test fixtures ... ok
set up test fixtures ... ok
test_sample (test.module_name.SampleTest) ... ok

----------------------------------------------------------------------
Ran 3 tests in 0.002s

OK

*つければ確かに次の階層までは見ているけど、これだと更に下の階層を作るとまた同じ結果かなぁ。
TestSuiteでどうにかするか、再帰で見に行く方法を考えてみるか……

4
4
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4