### Install covdefaults Source: https://github.com/asottile/covdefaults/blob/main/README.md Install the package using pip. ```bash pip install covdefaults ``` -------------------------------- ### Override run:source Options Source: https://github.com/asottile/covdefaults/blob/main/README.md Example for manually setting the source directory. ```ini [run] source = $PWD ``` -------------------------------- ### Version Specific Pragma Syntax Source: https://github.com/asottile/covdefaults/blob/main/README.md Examples of version-specific pragma comments. ```python # pragma: >=#.# cover ``` ```python if sys.version_info >= (3, 9): # pragma: >=3.9 cover print('3.9+') else: # pragma: <3.9 cover print('old') ``` -------------------------------- ### Platform Specific Pragma Syntax Source: https://github.com/asottile/covdefaults/blob/main/README.md Examples of platform-specific pragma comments. ```python # pragma: TAG no cover ``` ```python # pragma: TAG cover ``` ```python if sys.platform == 'win32': # pragma: win32 cover bin_dir = 'Scripts' else: # pragma: win32 no cover bin_dir = 'bin' ``` -------------------------------- ### Override run:omit Options Source: https://github.com/asottile/covdefaults/blob/main/README.md Examples for extending or subtracting from the default omit patterns. ```ini [run] omit = pre_commit/resources/* ``` ```ini [covdefaults] subtract_omit = */__main__.py ``` -------------------------------- ### Override report:fail_under Options Source: https://github.com/asottile/covdefaults/blob/main/README.md Example for setting a custom fail_under threshold. ```ini [report] fail_under = 90 ``` -------------------------------- ### Override report:exclude_lines Options Source: https://github.com/asottile/covdefaults/blob/main/README.md Example for adding custom exclude lines. ```ini [report] exclude_lines = ^if MYPY:$ ``` -------------------------------- ### Enable covdefaults Plugin Source: https://github.com/asottile/covdefaults/blob/main/README.md Configure the plugin in various supported configuration files. ```ini [run] plugins = covdefaults ``` ```ini [coverage:run] plugins = covdefaults ``` ```toml [tool.coverage.run] plugins = ["covdefaults"] ``` -------------------------------- ### Default Coverage Run Settings Source: https://github.com/asottile/covdefaults/blob/main/README.md Default configuration for the [coverage:run] section. ```ini branch = True source = . omit = */__main__.py */setup.py ``` -------------------------------- ### Default Coverage Report Settings Source: https://github.com/asottile/covdefaults/blob/main/README.md Default configuration for the [coverage:report] section, including exclude lines and partial branches. ```ini show_missing = True skip_covered = True fail_under = 100 exclude_lines = # a more strict default pragma \# pragma: no cover\b # allow defensive code ^\s*raise AssertionError\b ^\s*raise NotImplementedError\b ^\s*return NotImplemented\b ^\s*raise$ # typing-related code ^\s*if (False|TYPE_CHECKING): : \.\.\.(\s*#.*)?$ ^ +\.\.\.$ -> ['"]?NoReturn['"]?: # non-runnable code if __name__ == ['"]__main__['"]:$ # additional platform related pragmas (see below) # additional version related pragmas (see below) partial_branches = # a more strict default pragma \# pragma: no cover\b # our platform pragmas \# pragma: (nt|posix|cygwin|darwin|linux|msys|win32|cpython|pypy) (no )?cover\b # our version pragmas \# pragma: (>=?|<=?|==|!=)\d+\.\d+ cover\b ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.