0

我在 PyCharm 中使用 pytest 作为我的测试运行程序,但是当我尝试从 Pytest 测试启动Proboscis时,它无法识别 Pytest 注释。

run_tests.py

def run_tests():
    from proboscis import TestProgram
    import test_pytest_param

    # Run Proboscis and exit.
    TestProgram().run_and_exit()

if __name__ == '__main__':
    # Instead of running as main, try to run tests with pytest
    pass 

def test_run_proboscis_as_pytest():
    run_tests()

test_pytest_param.py

import pytest


def is_negative(n):
    return n < 0

@pytest.mark.parametrize("x",[7, -7])
def test_is_negative(x):
    assert is_negative(x) 

这失败了TypeError: test_is_negative() missing 1 required positional argument: 'x'

我可以用 Proboscis 以某种方式运行 Pytest,也许用命令行?

4

1 回答 1

0

我与 Proboscis 的作者交流,他写道它不能用 PyTest 运行。PyTest 的插件比移植 Proboscis 更有意义,因为 PyTest 的工作方式与 Nose / UnitTest 非常不同。

于 2019-10-21T14:09:09.003 回答