Anonymous committed 5f54fcd

Comments (0)

Files changed (2)


 def extract_constant(code,symbol,default=-1):
     """Extract the constant value of 'symbol' from 'code'
     If the name 'symbol' is bound to a constant value by the Python code
             return const
             const = default
+if sys.platform.startswith('java') or sys.platform == 'cli':
+    # XXX it'd be better to test assertions about bytecode instead...
+    del extract_constant, get_module_constant
+    __all__.remove('extract_constant')
+    __all__.remove('get_module_constant')


 """Tests for the 'setuptools' package"""
 from unittest import TestSuite, TestCase, makeSuite, defaultTestLoader
 import distutils.core, distutils.cmd
 from distutils.errors import DistutilsOptionError, DistutilsPlatformError
 import setuptools, setuptools.dist
 from setuptools import Feature
 from distutils.core import Extension
-from setuptools.depends import extract_constant, get_module_constant
-from setuptools.depends import find_module, Require
+extract_constant, get_module_constant = None, None
+from setuptools.depends import *
 from distutils.version import StrictVersion, LooseVersion
 from distutils.util import convert_path
 import sys, os.path
 class DependsTests(TestCase):
     def testExtractConst(self):
-        from setuptools.depends import extract_constant
+        if not extract_constant: return  # skip on non-bytecode platforms
         def f1():
             global x,y,z
         f,p,i = find_module('setuptools.tests'); f.close()
     def testModuleExtract(self):
+        if not get_module_constant: return  # skip on non-bytecode platforms
         from distutils import __version__
             get_module_constant('distutils','__version__'), __version__
     def testRequire(self):
+        if not extract_constant: return  # skip on non-bytecode platforms
         req = Require('Distutils','1.0.3','distutils')
 class DistroTests(TestCase):
     def setUp(self):