Mon, 19 Sep 2016 22:47:52 +0200
Preparation for combining the Python 2 and 3 debug clients. Base is Python 3.
4489
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
1 | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
2 | # For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
3 | |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
4 | """Determine facts about the environment.""" |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
5 | |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
6 | import os |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
7 | import sys |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
8 | |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
9 | # Operating systems. |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
10 | WINDOWS = sys.platform == "win32" |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
11 | LINUX = sys.platform == "linux2" |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
12 | |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
13 | # Python implementations. |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
14 | PYPY = '__pypy__' in sys.builtin_module_names |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
15 | |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
16 | # Python versions. |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
17 | PYVERSION = sys.version_info |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
18 | PY2 = PYVERSION < (3, 0) |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
19 | PY3 = PYVERSION >= (3, 0) |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
20 | |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
21 | # Coverage.py specifics. |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
22 | |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
23 | # Are we using the C-implemented trace function? |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
24 | C_TRACER = os.getenv('COVERAGE_TEST_TRACER', 'c') == 'c' |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
25 | |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
26 | # Are we coverage-measuring ourselves? |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
27 | METACOV = os.getenv('COVERAGE_COVERAGE', '') != '' |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
28 | |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
29 | # Are we running our test suite? |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
30 | # Even when running tests, you can use COVERAGE_TESTING=0 to disable the |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
31 | # test-specific behavior like contracts. |
d0d6e4ad31bd
Updated coverage to 4.0 (breaks with Python 3.2 support).
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
diff
changeset
|
32 | TESTING = os.getenv('COVERAGE_TESTING', '') == 'True' |