Pragmas in python

前端 未结 2 861
醉酒成梦
醉酒成梦 2021-02-01 12:23

I\'m reading bottle.py source code. It\'s a web framework, with only 3000+ lines python code. So cool.

I found some code like this:

class ServerAdapter(o         


        
2条回答
  •  时光说笑
    2021-02-01 13:03

    It is apparenly related to the coverage.py:

    Coverage.py is a tool for measuring code coverage of Python programs. It monitors your program, noting which parts of the code have been executed, then analyzes the source to identify code that could have been executed but was not.

    That exact # pragma: no cover is the hint that the part of code should be ignored by the tool -- see Excluding code from coverage .

提交回复
热议问题