[Python-checkins] distutils2: Please pep8 and pyflakes

tarek.ziade python-checkins at python.org
Thu Aug 19 08:34:14 CEST 2010


tarek.ziade pushed 18876861b47d to distutils2:

http://hg.python.org/distutils2/rev/18876861b47d
changeset:   589:18876861b47d
user:        ?ric Araujo <merwok at netwok.org>
date:        Sun Aug 15 06:11:05 2010 +0200
summary:     Please pep8 and pyflakes
files:       src/distutils2/tests/test_dist.py

diff --git a/src/distutils2/tests/test_dist.py b/src/distutils2/tests/test_dist.py
--- a/src/distutils2/tests/test_dist.py
+++ b/src/distutils2/tests/test_dist.py
@@ -15,6 +15,7 @@
 from distutils2.tests import support
 from distutils2.tests.support import unittest
 
+
 class test_dist(Command):
     """Sample distutils2 extension command."""
 
@@ -107,8 +108,8 @@
         sys.argv.append("build")
         f = open(TESTFN, "w")
         try:
-            print >>f, "[global]"
-            print >>f, "command_packages = foo.bar, splat"
+            print >> f, "[global]"
+            print >> f, "command_packages = foo.bar, splat"
             f.close()
             d = self.create_distribution([TESTFN])
             self.assertEqual(d.get_command_packages(),
@@ -141,7 +142,6 @@
                           'summary': u'Café torréfié',
                           'description': u'Héhéhé'})
 
-
         # let's make sure the file can be written
         # with Unicode fields. they are encoded with
         # PKG_INFO_ENCODING
@@ -154,7 +154,6 @@
                           'summary': 'Cafe torrefie',
                           'description': 'Hehehe'})
 
-        my_file2 = os.path.join(tmp_dir, 'f2')
         dist.metadata.write_file(open(my_file, 'w'))
 
     def test_bad_attr(self):
@@ -162,21 +161,22 @@
 
         # catching warnings
         warns = []
+
         def _warn(msg):
             warns.append(msg)
 
         old_warn = warnings.warn
         warnings.warn = _warn
         try:
-            dist = cls(attrs={'author': 'xxx',
-                              'name': 'xxx',
-                              'version': 'xxx',
-                              'url': 'xxxx',
-                              'badoptname': 'xxx'})
+            cls(attrs={'author': 'xxx',
+                       'name': 'xxx',
+                       'version': 'xxx',
+                       'url': 'xxxx',
+                       'badoptname': 'xxx'})
         finally:
             warnings.warn = old_warn
 
-        self.assertTrue(len(warns)==1 and "Unknown distribution" in warns[0])
+        self.assertTrue(len(warns) == 1 and "Unknown distribution" in warns[0])
 
     def test_empty_options(self):
         # an empty options dictionary should not stay in the
@@ -185,17 +185,18 @@
 
         # catching warnings
         warns = []
+
         def _warn(msg):
             warns.append(msg)
 
         old_warn = warnings.warn
         warnings.warn = _warn
         try:
-            dist = cls(attrs={'author': 'xxx',
-                              'name': 'xxx',
-                              'version': 'xxx',
-                              'url': 'xxxx',
-                              'options': {}})
+            cls(attrs={'author': 'xxx',
+                       'name': 'xxx',
+                       'version': 'xxx',
+                       'url': 'xxxx',
+                       'options': {}})
         finally:
             warnings.warn = old_warn
 
@@ -206,8 +207,9 @@
         # for a few cryptic comments in dist.py.  If this is to stay
         # in the public API, it deserves some better documentation.
 
-        # Here is an example of how it's used out there: 
-        # http://svn.pythonmac.org/py2app/py2app/trunk/doc/index.html#specifying-customizations
+        # Here is an example of how it's used out there:
+        # http://svn.pythonmac.org/py2app/py2app/trunk/doc/
+        # index.html#specifying-customizations
         cls = Distribution
         dist = cls(attrs={'author': 'xxx',
                           'name': 'xxx',
@@ -240,7 +242,6 @@
         cmds = dist.get_command_packages()
         self.assertEqual(cmds, ['distutils2.command', 'one', 'two'])
 
-
     def test_announce(self):
         # make sure the level is known
         dist = Distribution()
@@ -278,7 +279,7 @@
             os.path.expanduser = old_expander
 
         # make sure --no-user-cfg disables the user cfg file
-        self.assertEqual(len(all_files)-1, len(files))
+        self.assertEqual(len(all_files) - 1, len(files))
 
     def test_special_hooks_parsing(self):
         temp_home = self.mkdtemp()
@@ -286,16 +287,19 @@
                         os.path.join(temp_home, "config2.cfg")]
 
         # Store two aliased hooks in config files
-        self.write_file((temp_home, "config1.cfg"), '[test_dist]\npre-hook.a = type')
-        self.write_file((temp_home, "config2.cfg"), '[test_dist]\npre-hook.b = type')
+        self.write_file((temp_home, "config1.cfg"),
+                        '[test_dist]\npre-hook.a = type')
+        self.write_file((temp_home, "config2.cfg"),
+                         '[test_dist]\npre-hook.b = type')
 
         sys.argv.extend(["--command-packages",
                          "distutils2.tests",
                          "test_dist"])
-        cmd = self.create_distribution(config_files).get_command_obj("test_dist")
+        cmd = self.create_distribution(config_files).get_command_obj(
+             "test_dist")
+
         self.assertEqual(cmd.pre_hook, {"a": 'type', "b": 'type'})
 
-
     def test_hooks_get_run(self):
         temp_home = self.mkdtemp()
         config_file = os.path.join(temp_home, "config1.cfg")
@@ -319,6 +323,7 @@
         sys.argv.extend(["--command-packages",
                          "distutils2.tests",
                          "test_dist"])
+
         d = self.create_distribution([config_file])
         cmd = d.get_command_obj("test_dist")
 
@@ -559,6 +564,7 @@
         self.assertEqual(metadata['obsoletes'], [])
         self.assertEqual(metadata['requires-dist'], ['foo'])
 
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(DistributionTestCase))

--
Repository URL: http://hg.python.org/distutils2


More information about the Python-checkins mailing list