Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correct .coveragerc omitted files globs (#333)
Coverage.py file patterns only matches entire directories if the file pattern ends with a slash and asterisk ("/*"). In addition to the rule above, Coverage.py file patterns that start with a wildcard character only matches entire directories if the file pattern starts with an asterisk and slash ("*/"). Example: % python Python 3.8.11 (default, Aug 23 2021, 18:14:59) >>> import coverage >>> coverage.version_info (7, 2, 3, 'final', 0) >>> from coverage.files import GlobMatcher >>> GlobMatcher(["*migrations*"], "omit").match("/dir/project/migrations/0001_initial.py") False >>> GlobMatcher(["*/migrations/*"], "omit").match("/dir/project/migrations/0001_initial.py") True >>> GlobMatcher(["/dir/project/settings*"], "omit").match("/dir/project/settings/base.py") False >>> GlobMatcher(["/dir/project/settings/*"], "omit").match("/dir/project/settings/base.py") True >>> GlobMatcher(["*admin.py"], "omit").match("/dir/project/app/app_name/admin.py") True See: * [InOrOut.check_include_omit_etc()](https://github.com/nedbat/coveragepy/blob/cf3602ffa7396d8f784c1a1e814ff24c6c31f793/coverage/inorout.py#L444) * [GlobMatcher in self.omit](https://github.com/nedbat/coveragepy/blob/cf3602ffa7396d8f784c1a1e814ff24c6c31f793/coverage/inorout.py#L253) * [Definition of self.omit](https://github.com/nedbat/coveragepy/blob/cf3602ffa7396d8f784c1a1e814ff24c6c31f793/coverage/inorout.py#L205) * [Coverage.py glob documentation](https://coverage.readthedocs.io/en/7.2.5/source.html#file-patterns)
- Loading branch information