env.py 911 B

123456789101112131415161718192021222324252627282930313233
  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. """Determine facts about the environment."""
  4. import os
  5. import sys
  6. # Operating systems.
  7. WINDOWS = sys.platform == "win32"
  8. LINUX = sys.platform == "linux2"
  9. # Python implementations.
  10. PYPY = '__pypy__' in sys.builtin_module_names
  11. # Python versions.
  12. PYVERSION = sys.version_info
  13. PY2 = PYVERSION < (3, 0)
  14. PY3 = PYVERSION >= (3, 0)
  15. # Coverage.py specifics.
  16. # Are we using the C-implemented trace function?
  17. C_TRACER = os.getenv('COVERAGE_TEST_TRACER', 'c') == 'c'
  18. # Are we coverage-measuring ourselves?
  19. METACOV = os.getenv('COVERAGE_COVERAGE', '') != ''
  20. # Are we running our test suite?
  21. # Even when running tests, you can use COVERAGE_TESTING=0 to disable the
  22. # test-specific behavior like contracts.
  23. TESTING = os.getenv('COVERAGE_TESTING', '') == 'True'