diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-01-18 13:25:49 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-01-18 13:25:49 -0500 |
commit | 8d60d392c5d9b00560c4a9418902f12126dae125 (patch) | |
tree | c6634c5c0b940a32c1fb0afb36b4a928a91f3304 /tests/test_phystokens.py | |
parent | 0d0836309b6354a07fb09cd8d28b309b6c8dba6c (diff) | |
download | python-coveragepy-git-8d60d392c5d9b00560c4a9418902f12126dae125.tar.gz |
Collect all the nudgy environment checks into coverage.env
Diffstat (limited to 'tests/test_phystokens.py')
-rw-r--r-- | tests/test_phystokens.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/test_phystokens.py b/tests/test_phystokens.py index bbd956ea..b8986a80 100644 --- a/tests/test_phystokens.py +++ b/tests/test_phystokens.py @@ -2,13 +2,14 @@ import os import re -import sys from nose.plugins.skip import SkipTest -from tests.coveragetest import CoverageTest +from coverage import env from coverage.phystokens import source_token_lines, source_encoding +from tests.coveragetest import CoverageTest + SIMPLE = """\ # yay! @@ -87,7 +88,7 @@ class PhysTokensTest(CoverageTest): # The default encoding is different in Python 2 and Python 3. -if sys.version_info >= (3, 0): +if env.PY3: DEF_ENCODING = "utf-8" else: DEF_ENCODING = "ascii" @@ -110,11 +111,10 @@ class SourceEncodingTest(CoverageTest): self.assertEqual(source_encoding(source), 'utf-8') def test_detect_source_encoding_not_in_comment(self): - if '__pypy__' in sys.builtin_module_names: - if sys.version_info > (3, 0): - # PyPy3 gets this case wrong. Not sure what I can do about it, - # so skip the test. - raise SkipTest + if env.PYPY and env.PY3: + # PyPy3 gets this case wrong. Not sure what I can do about it, + # so skip the test. + raise SkipTest # Should not detect anything here source = b'def parse(src, encoding=None):\n pass' self.assertEqual(source_encoding(source), DEF_ENCODING) |