Commit 49dfb4a1 authored by PJ Eby's avatar PJ Eby

Fix http://bugs.python.org/setuptools/issue31 (backport from trunk)

--HG--
branch : setuptools-0.6
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4065948
parent 2d300753
......@@ -204,7 +204,6 @@ def get_module_constant(module, symbol, default=-1, paths=None):
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
......@@ -237,10 +236,11 @@ def extract_constant(code,symbol,default=-1):
return const
else:
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
......@@ -7,8 +6,8 @@ from distutils.errors import DistutilsSetupError
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
......@@ -41,14 +40,10 @@ def makeSetup(**args):
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
......@@ -74,6 +69,7 @@ class DependsTests(TestCase):
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__
self.assertEqual(
get_module_constant('distutils','__version__'), __version__
......@@ -86,6 +82,7 @@ class DependsTests(TestCase):
)
def testRequire(self):
if not extract_constant: return # skip on non-bytecode platforms
req = Require('Distutils','1.0.3','distutils')
......@@ -125,7 +122,6 @@ class DependsTests(TestCase):
self.failUnless(req.is_current(paths))
class DistroTests(TestCase):
def setUp(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment