nosetests通过多次测试跳过python中的某些测试

问题描述 投票:0回答:2

我想从构建或管道中跳过或排除某些特定测试。

我正在运行nosetests -s -v *,它运行某些特定文件夹下的所有测试。

假设有关于30 tests5我想跳过 - 要做到这一点我正在尝试

nosetests -s -v * --exclude-test test_sometest.py test_somemoretest.py

要么

nosetests -s -v * -- test_sometest.py test_somemoretest.py

但他们两个都不适合我。

I am referring from here

#!/bin/sh

cd tests/engine_tests/measures

nosetests -s -v * --exclude-test test_sometest1.py test_somemoretest2.py test_sometest3.py test_somemoretest4.py

任何帮助都会很棒!!

shell command-line build pipeline nose
2个回答
0
投票

将此参数添加到您的命令:--ignore-files="tests_to_exclude\.py"


0
投票
python -m pytest --cache-clear -v -x -r a --junit-xml=tests/engine_tests --junit-prefix=measure_tests *.py --deselect Test1\.py --deselect Test2\.py --deselect Test3\.py --deselect Test4\.py

我试过这个,它对我有用。在此之前您需要安装pytest

pip install pytest

通过在终端下键入pytest --help可以找到文档

或者某个地方here

© www.soinside.com 2019 - 2024. All rights reserved.