1 # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 2 # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt 3 4 """Determine facts about the environment.""" 5 6 import os 7 import sys 8 9 # Operating systems. 10 WINDOWS = sys.platform == "win32" 11 LINUX = sys.platform == "linux2" 12 13 # Python implementations. 14 PYPY = '__pypy__' in sys.builtin_module_names 15 16 # Python versions. 17 PYVERSION = sys.version_info 18 PY2 = PYVERSION < (3, 0) 19 PY3 = PYVERSION >= (3, 0) 20 21 # Coverage.py specifics. 22 23 # Are we using the C-implemented trace function? 24 C_TRACER = os.getenv('COVERAGE_TEST_TRACER', 'c') == 'c' 25 26 # Are we coverage-measuring ourselves? 27 METACOV = os.getenv('COVERAGE_COVERAGE', '') != '' 28 29 # Are we running our test suite? 30 # Even when running tests, you can use COVERAGE_TESTING=0 to disable the 31 # test-specific behavior like contracts. 32 TESTING = os.getenv('COVERAGE_TESTING', '') == 'True' 33