diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-11-04 07:20:50 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-11-04 07:20:50 -0400 |
commit | c7c32846ea2af9863fa921c5f5735ff3958b775f (patch) | |
tree | d455d8e4da0e4101bfffff1d1d6f62f2a61cad85 /coverage/inorout.py | |
parent | 8aa27024bdeb8950d61455b37a18bd508bf37904 (diff) | |
download | python-coveragepy-git-c7c32846ea2af9863fa921c5f5735ff3958b775f.tar.gz |
refactor(test): don't even import contracts if not using PyContracts
On CPython 3.11, PyContracts fails on import, so we need to shut it off more
completely.
PyContracts is unmaintained these days, so we'll probably get rid of it
completely soon.
Diffstat (limited to 'coverage/inorout.py')
-rw-r--r-- | coverage/inorout.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/coverage/inorout.py b/coverage/inorout.py index 8badf4f7..174a19dc 100644 --- a/coverage/inorout.py +++ b/coverage/inorout.py @@ -180,10 +180,11 @@ def add_coverage_paths(paths): # When testing, we use PyContracts, which should be considered # part of coverage.py, and it uses six. Exclude those directories # just as we exclude ourselves. - import contracts - import six - for mod in [contracts, six]: - paths.add(canonical_path(mod)) + if env.USE_CONTRACTS: + import contracts + import six + for mod in [contracts, six]: + paths.add(canonical_path(mod)) class InOrOut: |