Permalink
Browse files

PEP8/pyflakes cleanup.

  • Loading branch information...
1 parent 7efe6c6 commit d79e3f93d47a5c5554161df12f15bc79c93fa11c @dokai dokai committed May 21, 2012
Showing with 22 additions and 22 deletions.
  1. +3 −4 hexagonit/recipe/cmmi/__init__.py
  2. +19 −18 hexagonit/recipe/cmmi/tests.py
@@ -1,12 +1,13 @@
-import hexagonit.recipe.download
import errno
+import hexagonit.recipe.download
import imp
import logging
import os
import shutil
import subprocess
import zc.buildout
+
class Recipe(object):
"""zc.buildout recipe for compiling and installing software"""
@@ -82,7 +83,6 @@ def call_script(self, script):
# the third parameter
script(self.options, self.buildout)
-
def run(self, cmd):
"""Run the given ``cmd`` in a child process."""
log = logging.getLogger(self.name)
@@ -99,7 +99,6 @@ def run(self, cmd):
log.error('Command failed: %s: %s' % (e, cmd))
raise zc.buildout.UserError('System error')
-
def install(self):
log = logging.getLogger(self.name)
parts = []
@@ -108,7 +107,7 @@ def install(self):
make_options = ' '.join(self.options.get('make-options', '').split())
make_targets = ' '.join(self.options.get('make-targets', 'install').split())
- configure_options = self.options.get('configure-options','').split()
+ configure_options = self.options.get('configure-options', '').split()
configure_cmd = self.options.get('configure-command', '').strip()
if not configure_cmd:
@@ -13,15 +13,17 @@
import zc.buildout.testing
import zc.buildout.tests
-optionflags = (doctest.ELLIPSIS |
- doctest.NORMALIZE_WHITESPACE |
- doctest.REPORT_ONLY_FIRST_FAILURE)
+optionflags = (doctest.ELLIPSIS |
+ doctest.NORMALIZE_WHITESPACE |
+ doctest.REPORT_ONLY_FIRST_FAILURE)
+
def setUp(test):
zc.buildout.testing.buildoutSetUp(test)
zc.buildout.testing.install('hexagonit.recipe.download', test)
zc.buildout.testing.install_develop('hexagonit.recipe.cmmi', test)
+
class NonInformativeTests(unittest.TestCase):
def setUp(self):
@@ -33,7 +35,7 @@ def tearDown(self):
if var.startswith('HRC_'):
del os.environ[var]
- def write_file(self, filename, contents, mode=stat.S_IREAD|stat.S_IWUSR):
+ def write_file(self, filename, contents, mode=stat.S_IREAD | stat.S_IWUSR):
path = os.path.join(self.dir, filename)
fh = open(path, 'w')
fh.write(contents)
@@ -50,9 +52,9 @@ def make_recipe(self, buildout, name, options):
if e.errno != errno.EEXIST:
raise
bo = {
- 'buildout' : {
- 'parts-directory' : parts_directory_path,
- 'directory' : self.dir,
+ 'buildout': {
+ 'parts-directory': parts_directory_path,
+ 'directory': self.dir,
}
}
bo.update(buildout)
@@ -61,7 +63,7 @@ def make_recipe(self, buildout, name, options):
def test_working_directory_restored_after_failure(self):
compile_directory = os.path.join(self.dir, 'compile_directory')
os.makedirs(compile_directory)
- recipe = self.make_recipe({}, 'test', {'path' : compile_directory})
+ recipe = self.make_recipe({}, 'test', {'path': compile_directory})
os.chdir(self.dir)
self.assertRaises(zc.buildout.UserError, recipe.install)
@@ -72,7 +74,7 @@ def test_working_directory_restored_after_success(self):
os.makedirs(compile_directory)
self.write_file(os.path.join(compile_directory, 'configure'), 'Dummy configure')
- recipe = self.make_recipe({}, 'test', {'path' : compile_directory})
+ self.make_recipe({}, 'test', {'path': compile_directory})
os.chdir(self.dir)
self.assertEquals(self.dir, os.getcwd())
@@ -107,7 +109,7 @@ def test_restart_after_failure(self):
tar.add('Makefile')
tar.close()
- recipe = self.make_recipe({}, 'test', {'url' : tarfile_path})
+ recipe = self.make_recipe({}, 'test', {'url': tarfile_path})
os.chdir(self.dir)
try:
@@ -137,8 +139,8 @@ def test_environment_restored_after_building_a_part(self):
self.assertEquals(os.environ.get('HRC_SENTINEL'), 'sentinel')
recipe = self.make_recipe({}, 'test', {
- 'url' : 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__),
- 'environment' : 'HRC_FOO=bar\nHRC_BAR=foo'})
+ 'url': 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__),
+ 'environment': 'HRC_FOO=bar\nHRC_BAR=foo'})
os.chdir(self.dir)
recipe.install()
@@ -151,13 +153,12 @@ def test_environment_restored_after_building_a_part(self):
def test_run__unknown_command(self):
recipe = self.make_recipe({}, 'test', {
- 'url' : 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__)})
- self.assertRaises(zc.buildout.UserError, lambda:recipe.run('this-command-does-not-exist'))
-
+ 'url': 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__)})
+ self.assertRaises(zc.buildout.UserError, lambda: recipe.run('this-command-does-not-exist'))
def test_call_script__bbb_for_callable_with_two_parameters(self):
recipe = self.make_recipe({}, 'test', {
- 'url' : 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__),
+ 'url': 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__),
})
# The hook script does not return anything so we (ab)use exceptions
@@ -178,8 +179,8 @@ def test_call_script__augmented_environment_as_third_parameter(self):
os.environ['HRC_TESTVAR'] = 'foo'
recipe = self.make_recipe({}, 'test', {
- 'url' : 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__),
- 'environment' : 'HRC_TESTVAR=bar'
+ 'url': 'file://%s/testdata/package-0.0.0.tar.gz' % os.path.dirname(__file__),
+ 'environment': 'HRC_TESTVAR=bar'
})
# The hook script does not return anything so we (ab)use exceptions

0 comments on commit d79e3f9

Please sign in to comment.