nosetests没有运行fi中的所有测试

2024-10-01 00:17:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我跑

nosetests -v --nocapture --nologcapture tests/reward/test_stuff.py

我明白了

----------------------------------------------------------------------

    Ran 7 tests in 0.005s

    OK

不过,在没有使用lifixture的情况下,一些ike测试在没有使用lifixture的情况下无法正常运行:

^{pr2}$

装饰师是:

def use_fixtures(*fixtures):
    """
    Decorator for tests, abstracts the build-up required when using fixtures 
    """
    def real_use_fixtures(func):
        def use_fixtures_inner(*args, **kwargs):
            env = {}
            for cls in fixtures:
                name = cls.__name__
                table = name[:-5] #curtails _data
                env[table] = get_orm_class(table)

            fixture = SQLAlchemyFixture(env=env, engine=engine, style=TrimmedNameStyle(suffix="_data"))
            return fixture.with_data(*fixtures)(func)()
        return use_fixtures_inner
    return real_use_fixtures

我用装饰器来阻止noestests运行我的测试吗?在


Tags: nameinenvfordatareturnusedef
1条回答
网友
1楼 · 发布于 2024-10-01 00:17:47

我不知道您的decorator是否导致nose错过了测试,但是如果您与decorator一起进行测试,并且移除decorator足够长的时间来查看是否仍然错过了测试呢?在

相关问题 更多 >