Pytest: Deselecting tests

后端 未结 5 914
臣服心动
臣服心动 2021-01-31 07:28

With pytest, one can mark tests using a decorator

@pytest.mark.slow
def some_slow_test():
    pass

Then, from the command line, one can tell py

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-31 08:13

    Additionally, with the recent addition of the "-m" command line option you should be able to write:

    py.test -m "not (slow or long)"
    

    IOW, the "-m" option accepts an expression which can make use of markers as boolean values (if a marker does not exist on a test function it's value is False, if it exists, it is True).

提交回复
热议问题