From c7c32846ea2af9863fa921c5f5735ff3958b775f Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Thu, 4 Nov 2021 07:20:50 -0400 Subject: 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. --- coverage/misc.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'coverage/misc.py') diff --git a/coverage/misc.py b/coverage/misc.py index 40f00930..584efeaa 100644 --- a/coverage/misc.py +++ b/coverage/misc.py @@ -100,14 +100,9 @@ def dummy_decorator_with_args(*args_unused, **kwargs_unused): return _decorator -# Environment COVERAGE_NO_CONTRACTS=1 can turn off contracts while debugging -# tests to remove noise from stack traces. -# $set_env.py: COVERAGE_NO_CONTRACTS - Disable PyContracts to simplify stack traces. -USE_CONTRACTS = env.TESTING and not bool(int(os.environ.get("COVERAGE_NO_CONTRACTS", 0))) - # Use PyContracts for assertion testing on parameters and returns, but only if # we are running our own test suite. -if USE_CONTRACTS: +if env.USE_CONTRACTS: from contracts import contract # pylint: disable=unused-import from contracts import new_contract as raw_new_contract -- cgit v1.2.1