Jason R. Coombs avatar Jason R. Coombs committed f23d104 Merge

Merge fixes for depends module imports. Fixes in part #277.

Comments (0)

Files changed (1)

setuptools/tests/__init__.py

 import unittest
 
 import setuptools.dist
+import setuptools.depends as dep
 from setuptools import Feature
-from setuptools.depends import Require, find_module, get_module_constant, extract_constant
+from setuptools.depends import Require
 
 def additional_tests():
     suite = unittest.TestSuite((
 class DependsTests(unittest.TestCase):
 
     def testExtractConst(self):
-        if not extract_constant: return  # skip on non-bytecode platforms
+        if not hasattr(dep, 'extract_constant'):
+            # skip on non-bytecode platforms
+            return
 
         def f1():
             global x, y, z
             y = z
 
         # unrecognized name
-        self.assertEqual(extract_constant(f1.func_code,'q', -1), None)
+        self.assertEqual(dep.extract_constant(f1.func_code,'q', -1), None)
 
         # constant assigned
-        self.assertEqual(extract_constant(f1.func_code,'x', -1), "test")
+        self.assertEqual(dep.extract_constant(f1.func_code,'x', -1), "test")
 
         # expression assigned
-        self.assertEqual(extract_constant(f1.func_code,'y', -1), -1)
+        self.assertEqual(dep.extract_constant(f1.func_code,'y', -1), -1)
 
         # recognized name, not assigned
-        self.assertEqual(extract_constant(f1.func_code,'z', -1), None)
+        self.assertEqual(dep.extract_constant(f1.func_code,'z', -1), None)
 
     def testFindModule(self):
-        self.assertRaises(ImportError, find_module, 'no-such.-thing')
-        self.assertRaises(ImportError, find_module, 'setuptools.non-existent')
-        f,p,i = find_module('setuptools.tests')
+        self.assertRaises(ImportError, dep.find_module, 'no-such.-thing')
+        self.assertRaises(ImportError, dep.find_module, 'setuptools.non-existent')
+        f,p,i = dep.find_module('setuptools.tests')
         f.close()
 
     def testModuleExtract(self):
-        if not get_module_constant: return  # skip on non-bytecode platforms
+        if not hasattr(dep, 'get_module_constant'):
+            # skip on non-bytecode platforms
+            return
+
         from email import __version__
         self.assertEqual(
-            get_module_constant('email','__version__'), __version__
+            dep.get_module_constant('email','__version__'), __version__
         )
         self.assertEqual(
-            get_module_constant('sys','version'), sys.version
+            dep.get_module_constant('sys','version'), sys.version
         )
         self.assertEqual(
-            get_module_constant('setuptools.tests','__doc__'),__doc__
+            dep.get_module_constant('setuptools.tests','__doc__'),__doc__
         )
 
     def testRequire(self):
-        if not extract_constant: return  # skip on non-bytecode platforms
+        if not hasattr(dep, 'extract_constant'):
+            # skip on non-bytecode platformsh
+            return
 
         req = Require('Email','1.0.3','email')
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.