summaryrefslogtreecommitdiff
path: root/tests/test_misc.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-11-04 07:20:50 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-11-04 07:20:50 -0400
commitc7c32846ea2af9863fa921c5f5735ff3958b775f (patch)
treed455d8e4da0e4101bfffff1d1d6f62f2a61cad85 /tests/test_misc.py
parent8aa27024bdeb8950d61455b37a18bd508bf37904 (diff)
downloadpython-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 'tests/test_misc.py')
-rw-r--r--tests/test_misc.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/test_misc.py b/tests/test_misc.py
index 58dba6a8..bdee2b50 100644
--- a/tests/test_misc.py
+++ b/tests/test_misc.py
@@ -7,11 +7,11 @@ import sys
import pytest
+from coverage import env
from coverage.exceptions import CoverageException
from coverage.misc import contract, dummy_decorator_with_args, file_be_gone
from coverage.misc import Hasher, one_of, substitute_variables, import_third_party
from coverage.misc import human_sorted, human_sorted_items
-from coverage.misc import USE_CONTRACTS
from tests.coveragetest import CoverageTest
@@ -80,7 +80,7 @@ class RemoveFileTest(CoverageTest):
file_be_gone(".")
-@pytest.mark.skipif(not USE_CONTRACTS, reason="Contracts are disabled, can't test them")
+@pytest.mark.skipif(not env.USE_CONTRACTS, reason="Contracts are disabled, can't test them")
class ContractTest(CoverageTest):
"""Tests of our contract decorators."""