How to test single file under pytest

后端 未结 3 836
星月不相逢
星月不相逢 2020-12-23 16:05

How do you test a single file in pytest? I could only find ignore options and no \"test this file only\" option in the docs.

Preferably this would work on the comman

3条回答
  •  甜味超标
    2020-12-23 16:35

    This worked for me:

    python -m pytest -k some_test_file.py
    

    This works for individual test functions too:

    python -m pytest -k test_about_something
    

提交回复
热议问题