nose2找不到基本测试脚本

2024-05-18 15:46:09 发布

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

我有一个python应用程序的测试套件,可以用nose2运行。你知道吗

我以前把所有的测试都放在一个文件中;但是,这个文件有超过1500行的长度,所以我把它分成了多个独立的文件。你知道吗

这套房以前是这样的:

tests/
    test_all.py

我将在tests目录外使用以下命令运行一个测试:

nose2 tests.test_all.MyTestCase.test_something

现在我的套房看起来像这样:

tests/
    base.py
    test_inputs.py
    test_outputs.py
    test_reports.py

测试base.py(它只是设置测试类,本身没有测试)工作正常:

nose2 tests.base

但是当我运行以下命令时,我得到一个AttributeError: 'module' object has no attribute 'test_output'

nose2 tests.test_output

进一步回溯,我看到以下错误:ImportError: No Module named 'base'。如何告诉nose2使用base.py?你知道吗


Tags: 文件pytest命令目录应用程序outputbase

热门问题