env.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 platform
  6. import sys
  7. # Operating systems.
  8. WINDOWS = sys.platform == "win32"
  9. LINUX = sys.platform == "linux2"
  10. # Python implementations.
  11. PYPY = (platform.python_implementation() == 'PyPy')
  12. if PYPY:
  13. PYPYVERSION = sys.pypy_version_info
  14. JYTHON = (platform.python_implementation() == 'Jython')
  15. IRONPYTHON = (platform.python_implementation() == 'IronPython')
  16. # Python versions.
  17. PYVERSION = sys.version_info
  18. PY2 = PYVERSION < (3, 0)
  19. PY3 = PYVERSION >= (3, 0)
  20. # Coverage.py specifics.
  21. # Are we using the C-implemented trace function?
  22. C_TRACER = os.getenv('COVERAGE_TEST_TRACER', 'c') == 'c'
  23. # Are we coverage-measuring ourselves?
  24. METACOV = os.getenv('COVERAGE_COVERAGE', '') != ''
  25. # Are we running our test suite?
  26. # Even when running tests, you can use COVERAGE_TESTING=0 to disable the
  27. # test-specific behavior like contracts.
  28. TESTING = os.getenv('COVERAGE_TESTING', '') == 'True'