Metadata-Version: 2.1
Name: coverage-simple-excludes
Version: 0.9.0
Summary: Simple `coverage` Exclusions
Author-email: Hauke D <haukex@zero-g.net>
Project-URL: Repository, https://github.com/haukex/coverage-simple-excludes
Project-URL: Bug Tracker, https://github.com/haukex/coverage-simple-excludes/issues
Project-URL: Changelog, https://github.com/haukex/coverage-simple-excludes/blob/main/CHANGELOG.md
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)
Classifier: Development Status :: 4 - Beta
Classifier: Operating System :: POSIX
Classifier: Operating System :: Unix
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: coverage>=7.1.0
Requires-Dist: re-int-ineq>=0.9.0

Simple ``coverage`` Exclusions
==============================

This is a simple plugin for [Coverage.py](https://pypi.org/project/coverage/).
When you enable it, for example in `pyproject.toml`:

```toml
[tool.coverage.run]
plugins = ["coverage_simple_excludes"]
```

Then, in addition to the default `# pragma: no cover`, you get several more comments in the
format `# cover-...` that you can use to specify that lines or blocks of code should be excluded from coverage:

- `# cover-req-ltX.Y` and `# cover-req-geX.Y`, where:
  - `X` and `Y` are the major and minor Python version, respectively
  - `lt` means "a Python version lower than `X.Y` is required for this line or block of code
    to be executed and included in the coverage check"
  - `ge` means "a Python version equal to or higher than `X.Y` is required"
- `# cover-not-Z` and `# cover-only-Z`, where:
  - `not` means "this code is not executed on this os/platform/implementation"
  - `only` means "this code is only executed on this os/platform/implementation"
  - `Z` may be any of the following values:
    - [`os.name`](https://docs.python.org/3/library/os.html#os.name):
      "posix", "nt", "java"
    - [`sys.platform`](https://docs.python.org/3/library/sys.html#sys.platform):
      "aix", "emscripten", "linux", "wasi", "win32", "cygwin", "darwin"
    - [`sys.implementation.name`](https://docs.python.org/3/library/sys.html#sys.implementation):
      "cpython", "ironpython", "jython", "pypy"

Note the comments are case-sensitive. Any amount of whitespace is allowed between
the `#` and `cover`, including no space.

Examples
--------

```python
if sys.platform != 'win32':  # cover-not-win32
    print("This code is only executed on non-win32 systems")
else:  # cover-only-win32
    print("This code is only executed on win32 systems")

if sys.hexversion < 0x03_0C:  # cover-req-lt3.12
    print("This code is only executed on a version of Python before 3.12")
else:  # cover-req-ge3.12
    print("This code is only executed on Python 3.12 or later")
```


Author, Copyright, and License
------------------------------

Copyright (c) 2024 Hauke Dämpfling (haukex@zero-g.net)
at the Leibniz Institute of Freshwater Ecology and Inland Fisheries (IGB),
Berlin, Germany, <https://www.igb-berlin.de/>

This library is free software: you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation, either version 3 of the License, or (at your option) any
later version.

This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.

You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
