[Python-checkins] python/nondist/sandbox/setuptools/setuptools/tests __init__.py, 1.3, 1.4

fdrake at users.sourceforge.net fdrake at users.sourceforge.net
Mon Apr 5 16:21:56 EDT 2004


Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7751/setuptools/tests
Modified Files:
	__init__.py 
Log Message:
remove excess blank lines, and apply whitespace more in line with the Python
style guidelines in PEP 8
Index: __init__.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/tests/__init__.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** __init__.py	22 Mar 2004 01:12:31 -0000	1.3
--- __init__.py	5 Apr 2004 20:21:52 -0000	1.4
***************
*** 1,16 ****
 """Tests for the 'setuptools' package"""
 
! from unittest import TestSuite, TestCase, makeSuite
 import distutils.core, distutils.cmd
 from distutils.errors import DistutilsOptionError, DistutilsPlatformError
 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
- from distutils.version import StrictVersion, LooseVersion
- from distutils.util import convert_path
- import sys, os.path
 
 
--- 1,21 ----
 """Tests for the 'setuptools' package"""
 
! import os.path
! import sys
! 
! from unittest import TestSuite, TestCase, makeSuite, main
! 
 import distutils.core, distutils.cmd
+ from distutils.core import Extension
 from distutils.errors import DistutilsOptionError, DistutilsPlatformError
 from distutils.errors import DistutilsSetupError
+ from distutils.util import convert_path
+ from distutils.version import StrictVersion, LooseVersion
+ 
 import setuptools, setuptools.dist
+ 
 from setuptools import Feature
 from setuptools.depends import extract_constant, get_module_constant
 from setuptools.depends import find_module, Require
 
 
***************
*** 21,25 ****
 
 # Don't let system command line leak into tests!
! args.setdefault('script_args',['install'])
 
 try:
--- 26,30 ----
 
 # Don't let system command line leak into tests!
! args.setdefault('script_args', ['install'])
 
 try:
***************
*** 29,47 ****
 
 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
 class DependsTests(TestCase):
 
 def testExtractConst(self):
- 
 from setuptools.depends import extract_constant
 
--- 34,40 ----
***************
*** 71,86 ****
 def testModuleExtract(self):
 from distutils import __version__
! self.assertEqual(
! get_module_constant('distutils','__version__'), __version__
! )
! self.assertEqual(
! get_module_constant('sys','version'), sys.version
! )
! self.assertEqual(
! get_module_constant('setuptools.tests','__doc__'),__doc__
! )
 
 def testRequire(self):
- 
 req = Require('Distutils','1.0.3','distutils')
 
--- 64,75 ----
 def testModuleExtract(self):
 from distutils import __version__
! self.assertEqual(get_module_constant('distutils', '__version__'),
! __version__)
! self.assertEqual(get_module_constant('sys', 'version'),
! sys.version)
! self.assertEqual(get_module_constant('setuptools.tests', '__doc__'),
! __doc__)
 
 def testRequire(self):
 req = Require('Distutils','1.0.3','distutils')
 
***************
*** 100,104 ****
 self.failUnless(req.is_current())
 
! req = Require('Distutils 3000','03000','distutils',format=LooseVersion)
 self.failUnless(req.is_present())
 self.failIf(req.is_current())
--- 89,94 ----
 self.failUnless(req.is_current())
 
! req = Require('Distutils 3000', '03000', 'distutils',
! format=LooseVersion)
 self.failUnless(req.is_present())
 self.failIf(req.is_current())
***************
*** 120,136 ****
 self.failUnless(req.is_current(paths))
 
- 
- 
 def testDependsCmd(self):
 path1 = convert_path('foo/bar/baz')
 path2 = convert_path('foo/bar/baz/spam')
 
! dist = makeSetup(
! extra_path='spam',
! script_args=[
! 'install','--install-lib',path1, '--prefix',path2,
! 'build','--compiler=mingw32', 
! ]
! )
 
 cmd = dist.get_command_obj('depends')
--- 110,121 ----
 self.failUnless(req.is_current(paths))
 
 def testDependsCmd(self):
 path1 = convert_path('foo/bar/baz')
 path2 = convert_path('foo/bar/baz/spam')
 
! dist = makeSetup(extra_path='spam',
! script_args=['install', '--install-lib', path1,
! '--prefix', path2,
! 'build', '--compiler=mingw32',])
 
 cmd = dist.get_command_obj('depends')
***************
*** 138,164 ****
 
 self.assertEqual(cmd.temp, dist.get_command_obj('build').build_temp)
! self.assertEqual(cmd.search_path, [path2,path1]+sys.path)
 
 self.assertEqual(cmd.unsafe_options,
! {'install':['--install-lib',path1]}
! )
 self.assertEqual(cmd.safe_options, {
 'build':['--compiler','mingw32'],
! 'install':['--prefix',os.path.abspath(path2)]
! })
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
 
 
--- 123,133 ----
 
 self.assertEqual(cmd.temp, dist.get_command_obj('build').build_temp)
! self.assertEqual(cmd.search_path, [path2,path1] + sys.path)
 
 self.assertEqual(cmd.unsafe_options,
! {'install': ['--install-lib',path1]})
 self.assertEqual(cmd.safe_options, {
 'build':['--compiler','mingw32'],
! 'install':['--prefix',os.path.abspath(path2)]})
 
 
***************
*** 180,187 ****
 )
 
- 
 def testDistroType(self):
! self.failUnless(isinstance(self.dist,setuptools.dist.Distribution))
! 
 
 def testExcludePackage(self):
--- 149,154 ----
 )
 
 def testDistroType(self):
! self.failUnless(isinstance(self.dist, setuptools.dist.Distribution))
 
 def testExcludePackage(self):
***************
*** 202,207 ****
 makeSetup().exclude_package('x')
 
- 
- 
 def testIncludeExclude(self):
 # remove an extension
--- 169,172 ----
***************
*** 242,287 ****
 self.failIf(self.dist.has_contents_for('c'))
 
- 
- 
- 
 def testInvalidIncludeExclude(self):
 self.assertRaises(DistutilsSetupError,
! self.dist.include, nonexistent_option='x'
! )
 self.assertRaises(DistutilsSetupError,
! self.dist.exclude, nonexistent_option='x'
! )
 self.assertRaises(DistutilsSetupError,
! self.dist.include, packages={'x':'y'}
! )
 self.assertRaises(DistutilsSetupError,
! self.dist.exclude, packages={'x':'y'}
! )
 self.assertRaises(DistutilsSetupError,
! self.dist.include, ext_modules={'x':'y'}
! )
 self.assertRaises(DistutilsSetupError,
! self.dist.exclude, ext_modules={'x':'y'}
! )
 
 self.assertRaises(DistutilsSetupError,
! self.dist.include, package_dir=['q']
! )
 self.assertRaises(DistutilsSetupError,
! self.dist.exclude, package_dir=['q']
! )
 
 def testCmdLineOpts(self):
! self.assertEqual(self.dist.get_cmdline_options(),
! { 'install':{'prefix':'/usr/lib', 'install-lib':'/test'},
! 'build': {'quiet':None}, 'build_ext':{'inplace':None},
! }
! )
! 
! 
! 
! 
! 
! 
 
 
--- 207,236 ----
 self.failIf(self.dist.has_contents_for('c'))
 
 def testInvalidIncludeExclude(self):
 self.assertRaises(DistutilsSetupError,
! self.dist.include, nonexistent_option='x')
 self.assertRaises(DistutilsSetupError,
! self.dist.exclude, nonexistent_option='x')
 self.assertRaises(DistutilsSetupError,
! self.dist.include, packages={'x':'y'})
 self.assertRaises(DistutilsSetupError,
! self.dist.exclude, packages={'x':'y'})
 self.assertRaises(DistutilsSetupError,
! self.dist.include, ext_modules={'x':'y'})
 self.assertRaises(DistutilsSetupError,
! self.dist.exclude, ext_modules={'x':'y'})
 
 self.assertRaises(DistutilsSetupError,
! self.dist.include, package_dir=['q'])
 self.assertRaises(DistutilsSetupError,
! self.dist.exclude, package_dir=['q'])
 
 def testCmdLineOpts(self):
! self.assertEqual(
! self.dist.get_cmdline_options(),
! {'install':{'prefix':'/usr/lib', 'install-lib':'/test'},
! 'build': {'quiet':None},
! 'build_ext': {'inplace':None},
! })
 
 
***************
*** 296,344 ****
 py_modules=['bar_et'], remove=['bar.ext'],
 ),
! 'baz': Feature(
! "baz", optional=False, packages=['pkg.baz'],
! scripts = ['scripts/baz_it'],
! libraries=[('libfoo','foo/foofoo.c')]
 ),
 'dwim': Feature("DWIM", available=False, remove='bazish'),
! },
 script_args=['--without-bar', 'install'],
! packages = ['pkg.bar', 'pkg.foo'],
! py_modules = ['bar_et', 'bazish'],
! ext_modules = [Extension('bar.ext',['bar.c'])]
 )
 
 def testDefaults(self):
 self.failIf(
! Feature(
! "test",standard=True,remove='x',available=False
! ).include_by_default()
! )
 self.failUnless(
! Feature("test",standard=True,remove='x').include_by_default()
! )
 # Feature must have either kwargs, removes, or requires
 self.assertRaises(DistutilsSetupError, Feature, "test")
 
 def testAvailability(self):
! self.assertRaises(
! DistutilsPlatformError,
! self.dist.features['dwim'].include_in, self.dist
! )
 
 def testFeatureOptions(self):
 dist = self.dist
! self.failUnless(
! ('with-dwim',None,'include DWIM') in dist.feature_options
! )
! self.failUnless(
! ('without-dwim',None,'exclude DWIM (default)') in dist.feature_options
! )
! self.failUnless(
! ('with-bar',None,'include bar (default)') in dist.feature_options
! )
! self.failUnless(
! ('without-bar',None,'exclude bar') in dist.feature_options
! )
 self.assertEqual(dist.feature_negopt['without-foo'],'with-foo')
 self.assertEqual(dist.feature_negopt['without-bar'],'with-bar')
--- 245,283 ----
 py_modules=['bar_et'], remove=['bar.ext'],
 ),
! 'baz': Feature("baz", optional=False, packages=['pkg.baz'],
! scripts=['scripts/baz_it'],
! libraries=[('libfoo','foo/foofoo.c')]
 ),
 'dwim': Feature("DWIM", available=False, remove='bazish'),
! },
 script_args=['--without-bar', 'install'],
! packages=['pkg.bar', 'pkg.foo'],
! py_modules=['bar_et', 'bazish'],
! ext_modules=[Extension('bar.ext',['bar.c'])]
 )
 
 def testDefaults(self):
 self.failIf(
! Feature("test",standard=True,remove='x',available=False
! ).include_by_default())
 self.failUnless(
! Feature("test",standard=True,remove='x').include_by_default())
 # Feature must have either kwargs, removes, or requires
 self.assertRaises(DistutilsSetupError, Feature, "test")
 
 def testAvailability(self):
! self.assertRaises(DistutilsPlatformError,
! self.dist.features['dwim'].include_in, self.dist)
 
 def testFeatureOptions(self):
 dist = self.dist
! self.failUnless(('with-dwim', None, 'include DWIM')
! in dist.feature_options)
! self.failUnless(('without-dwim', None, 'exclude DWIM (default)')
! in dist.feature_options)
! self.failUnless(('with-bar', None, 'include bar (default)')
! in dist.feature_options)
! self.failUnless(('without-bar', None, 'exclude bar')
! in dist.feature_options)
 self.assertEqual(dist.feature_negopt['without-foo'],'with-foo')
 self.assertEqual(dist.feature_negopt['without-bar'],'with-bar')
***************
*** 364,370 ****
 
 def testFeatureWithInvalidRemove(self):
! self.assertRaises(
! SystemExit, makeSetup, features = {'x':Feature('x', remove='y')}
! )
 
 class TestCommandTests(TestCase):
--- 303,309 ----
 
 def testFeatureWithInvalidRemove(self):
! self.assertRaises(SystemExit,
! makeSetup, features={'x': Feature('x', remove='y')})
! 
 
 class TestCommandTests(TestCase):
***************
*** 389,393 ****
 test_suite='bar.tests',
 script_args=['test','-m','foo.tests']
! ).get_command_obj('test')
 ts3.ensure_finalized()
 self.assertEqual(ts3.test_module, 'foo.tests')
--- 328,332 ----
 test_suite='bar.tests',
 script_args=['test','-m','foo.tests']
! ).get_command_obj('test')
 ts3.ensure_finalized()
 self.assertEqual(ts3.test_module, 'foo.tests')
***************
*** 397,401 ****
 ts4 = makeSetup(
 script_args=['test','-m','bar.tests', '-s','foo.tests.suite']
! ).get_command_obj('test')
 self.assertRaises(DistutilsOptionError, ts4.ensure_finalized)
 
--- 336,340 ----
 ts4 = makeSetup(
 script_args=['test','-m','bar.tests', '-s','foo.tests.suite']
! ).get_command_obj('test')
 self.assertRaises(DistutilsOptionError, ts4.ensure_finalized)
 
***************
*** 406,412 ****
 
 
- 
- 
- 
 testClasses = (DependsTests, DistroTests, FeatureTests, TestCommandTests)
 
--- 345,348 ----
***************
*** 414,451 ****
 return TestSuite([makeSuite(t,'test') for t in testClasses])
 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
--- 350,356 ----
 return TestSuite([makeSuite(t,'test') for t in testClasses])
 
! if __name__ == "__main__":
! # We have to run this from an imported setuptools.tests package,
! # since the tests themselves rely on __path__.
! import setuptools.tests
! main(defaultTest="setuptools.tests.test_suite")


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /