preventing python coverage from including virtual environment site packages

前端 未结 3 428
天命终不由人
天命终不由人 2021-02-06 20:38

I am new to coverage and ran into a strange problem. My coverage is taking my virtual environment site packages into account. Here is the output of the coverage run:

<         


        
3条回答
  •  长发绾君心
    2021-02-06 21:12

    If using pytest, you can specify exclusive paths or files to test in setup.cfg (see docs):

    [pytest]
    # a directory
    testpaths = tests
    
    # exact file(s)
    python_files = tests/test1.py tests/test2.py
    

    It looks like if you include the python_files and testpaths parameters, then the python_files will only be used.

提交回复
热议问题