add pep8 tests and fix statement errors

This commit is contained in:
Paul Morgan 2014-02-15 21:25:40 +00:00
parent 1a8ac66e06
commit 4fe4ed4de7
5 changed files with 9 additions and 8 deletions

View file

@ -382,7 +382,7 @@ class Builder(ConfigObject, BuilderBase):
build_version = self.build_tag[len(self.project_name + "-"):]
else:
build_version = get_latest_tagged_version(self.project_name)
if build_version == None:
if build_version is None:
error_out(["Unable to lookup latest package info.",
"Perhaps you need to tag first?"])
self.build_tag = "%s-%s" % (self.project_name, build_version)
@ -1273,7 +1273,7 @@ class ExternalSourceBuilder(ConfigObject, BuilderBase):
build_version = self.build_tag[len(self.project_name + "-"):]
else:
build_version = get_latest_tagged_version(self.project_name)
if build_version == None:
if build_version is None:
pass
self.build_tag = "%s-%s" % (self.project_name, build_version)

View file

@ -297,7 +297,7 @@ class BaseCliModule(object):
wrote_temp_file = True
# TODO: can we parse config from a string and stop writing temp files?
if properties_file != None:
if properties_file is not None:
debug("Using package specific properties: %s" % properties_file)
self.config.read(properties_file)
else:

View file

@ -154,7 +154,7 @@ def create_builder(package_name, build_tag,
def find_file_with_extension(in_dir=None, suffix=None):
""" Find the file with given extension in the current directory. """
if in_dir == None:
if in_dir is None:
in_dir = os.getcwd()
file_name = None
debug("Looking for %s in %s" % (suffix, in_dir))
@ -368,7 +368,7 @@ def get_project_name(tag=None, scl=None):
Extract the project name from the specified tag or a spec file in the
current working directory. Error out if neither is present.
"""
if tag != None:
if tag is not None:
p = re.compile('(.*?)-(\d.*)')
m = p.match(tag)
if not m:
@ -543,7 +543,7 @@ def get_latest_tagged_version(package_name):
return None
output = run_command("awk '{ print $1 ; exit }' %s" % file_path)
if output == None or output.strip() == "":
if output is None or output.strip() == "":
error_out("Error looking up latest tagged version in: %s" % file_path)
return output

View file

@ -219,7 +219,7 @@ class VersionTagger(ConfigObject):
old_version = get_latest_tagged_version(self.project_name)
# don't die if this is a new package with no history
if old_version != None:
if old_version is not None:
last_tag = "%s-%s" % (self.project_name, old_version)
output = self._generate_default_changelog(last_tag)
else:
@ -350,7 +350,7 @@ class VersionTagger(ConfigObject):
bump the version or release.
"""
old_version = get_latest_tagged_version(self.project_name)
if old_version == None:
if old_version is None:
old_version = "untagged"
if not self.keep_version:
version_regex = re.compile("^(version:\s*)(.+)$", re.IGNORECASE)

View file

@ -35,6 +35,7 @@ class TestPep8(TitoUnitTestFixture):
'E2', # whitespace errors
'E3', # blank line errors
'E4', # import errors
'E7', # statement errors
'E9', # runtime errors (SyntaxError, IndentationError, IOError)
'W2', # whitespace warnings
'W3', # blank line warnings