diff options
author | Daniel Holth <dholth@fastmail.fm> | 2012-09-17 08:40:37 -0400 |
---|---|---|
committer | Daniel Holth <dholth@fastmail.fm> | 2012-09-17 08:40:37 -0400 |
commit | 25d00ab637a11693f0a82548904058095f0a64cb (patch) | |
tree | 408d590cad4b9534effc672b788ea4b9bc8aefa1 | |
parent | 165f95218ab30580eafba4e2571e03ed14ca482f (diff) | |
download | external_python_setuptools-25d00ab637a11693f0a82548904058095f0a64cb.tar.gz external_python_setuptools-25d00ab637a11693f0a82548904058095f0a64cb.tar.bz2 external_python_setuptools-25d00ab637a11693f0a82548904058095f0a64cb.zip |
skip markerlib tests on Python < 2.6 (no ast compilation)
--HG--
branch : distribute
extra : rebase_source : 2044b531becb5ca6882bfb3b59ab53aac2c8ae2e
-rw-r--r-- | setuptools/tests/test_dist_info.py | 6 | ||||
-rw-r--r-- | setuptools/tests/test_markerlib.py | 40 |
2 files changed, 6 insertions, 40 deletions
diff --git a/setuptools/tests/test_dist_info.py b/setuptools/tests/test_dist_info.py index 70dce2d4..623ccc47 100644 --- a/setuptools/tests/test_dist_info.py +++ b/setuptools/tests/test_dist_info.py @@ -7,7 +7,7 @@ import unittest import textwrap try: - import _markerlib + import ast except: pass @@ -34,8 +34,8 @@ class TestDistInfo(unittest.TestCase): assert versioned.version == '2.718' # from filename assert unversioned.version == '0.3' # from METADATA - @skipIf('_markerlib' not in globals(), - "_markerlib is used to test conditional dependencies (Python >= 2.5)") + @skipIf('ast' not in globals(), + "ast is used to test conditional dependencies (Python >= 2.6)") def test_conditional_dependencies(self): requires = [pkg_resources.Requirement.parse('splort==4'), pkg_resources.Requirement.parse('quux>=1.1')] diff --git a/setuptools/tests/test_markerlib.py b/setuptools/tests/test_markerlib.py index 4cce0430..7ff2f584 100644 --- a/setuptools/tests/test_markerlib.py +++ b/setuptools/tests/test_markerlib.py @@ -3,14 +3,14 @@ import unittest from setuptools.tests.py26compat import skipIf try: - import _ast + import ast except ImportError: pass class TestMarkerlib(unittest.TestCase): - @skipIf('_ast' not in globals(), - "ast not available (Python < 2.5?)") + @skipIf('ast' not in globals(), + "ast not available (Python < 2.6?)") def test_markers(self): from _markerlib import interpret, default_environment, compile @@ -62,37 +62,3 @@ class TestMarkerlib(unittest.TestCase): statement = "python_version == '5'" self.assertEqual(compile(statement).__doc__, statement) - @skipIf('_ast' not in globals(), - "ast not available (Python < 2.5?)") - def test_ast(self): - try: - import ast, nose - raise nose.SkipTest() - except ImportError: - pass - - # Nonsensical code coverage tests. - import _markerlib._markers_ast as _markers_ast - - class Node(_ast.AST): - _fields = ('bogus') - list(_markers_ast.iter_fields(Node())) - - class Node2(_ast.AST): - def __init__(self): - self._fields = ('bogus',) - self.bogus = [Node()] - - class NoneTransformer(_markers_ast.NodeTransformer): - def visit_Attribute(self, node): - return None - - def visit_Str(self, node): - return None - - def visit_Node(self, node): - return [] - - NoneTransformer().visit(_markers_ast.parse('a.b = "c"')) - NoneTransformer().visit(Node2()) - |