add pep8 tests and fix blank line errors and warnings

This commit is contained in:
Paul Morgan 2014-02-15 20:22:11 +00:00
parent 1a772c5995
commit 97b29d6c35
14 changed files with 13 additions and 19 deletions

View file

@ -21,6 +21,7 @@ from tito.config_object import ConfigObject
from tito.common import error_out, debug, get_spec_version_and_release, \
get_class_by_name
class FetchBuilder(ConfigObject, BuilderBase):
"""
A separate Builder class for projects whose source is not in git. Source
@ -212,5 +213,3 @@ class ArgSourceStrategy(SourceStrategy):
in_f.close()
out_f.close()
shutil.move(self.spec_file + ".new", self.spec_file)

View file

@ -287,7 +287,6 @@ class BuilderBase(object):
pass
class Builder(ConfigObject, BuilderBase):
"""
Parent builder class.
@ -373,7 +372,6 @@ class Builder(ConfigObject, BuilderBase):
# Set to path to srpm once we build one.
self.srpm_location = None
def _get_build_version(self):
"""
Figure out the git tag and version-release we're building.
@ -1295,7 +1293,3 @@ class ExternalSourceBuilder(ConfigObject, BuilderBase):
else:
version = self.build_version.split("-")[0]
return version

View file

@ -308,7 +308,6 @@ class BaseCliModule(object):
# Delete the temp properties file we created.
run_command("rm %s" % properties_file)
def _validate_options(self):
"""
Subclasses can implement if they need to check for any

View file

@ -169,6 +169,7 @@ def find_file_with_extension(in_dir=None, suffix=None):
else:
return file_name
def find_spec_file(in_dir=None):
"""
Find the first spec file in the current directory.
@ -210,6 +211,7 @@ def extract_sha1(output):
else:
return ""
def run_command(command, print_on_success=False):
"""
Run command.
@ -360,6 +362,7 @@ def scl_to_rpm_option(scl, silent=None):
rpm_options += " --eval '%undefine scl'"
return rpm_options
def get_project_name(tag=None, scl=None):
"""
Extract the project name from the specified tag or a spec file in the
@ -632,4 +635,3 @@ def find_wrote_in_rpmbuild_output(output):
if not paths:
error_out("Unable to locate 'Wrote: ' lines in rpmbuild output")
return paths

View file

@ -17,6 +17,7 @@ Shared code for builder and tagger class
import os
from tito.common import find_git_root
class ConfigObject(object):
"""
Perent class for Builder and Tagger with shared code
@ -38,4 +39,3 @@ class ConfigObject(object):
self.git_root = find_git_root()
self.rel_eng_dir = os.path.join(self.git_root, "rel-eng")

View file

@ -4,6 +4,7 @@ from tito.builder import UpstreamBuilder
from tito.common import debug, run_command, error_out
import commands
class DistributionBuilder(UpstreamBuilder):
""" This class is used for building packages for distributions.
Parent class UpstreamBuilder build one big patch from upstream and create e.g.:

View file

@ -29,6 +29,7 @@ class TitoException(Exception):
def __str__(self):
return "TitoException: %s" % self.message
class RunCommandException(Exception):
""" Raised by run_command() """
def __init__(self, msg, command, status, output):

View file

@ -142,7 +142,6 @@ class ObsReleaser(Releaser):
self.cli_tool, self.obs_project_name, self.obs_package_name))
print("Aborting automatic rebuild because --no-build has been specified.")
def _obs_sync_files(self, project_checkout):
"""
Copy files from our obs checkout into each obs checkout and add them.
@ -164,4 +163,3 @@ class ObsReleaser(Releaser):
# Add/remove everything:
run_command("%s addremove" % (self.cli_tool))

View file

@ -37,6 +37,7 @@ from tito.common import (debug, error_out, run_command,
from tito.exception import TitoException
from tito.config_object import ConfigObject
class VersionTagger(ConfigObject):
"""
Standard Tagger class, used for tagging packages built from source in
@ -626,5 +627,3 @@ class ForceVersionTagger(VersionTagger):
self._update_changelog(new_version)
self._update_setup_py(new_version)
self._update_package_metadata(new_version)

View file

@ -35,6 +35,7 @@ builder = tito.builder.FetchBuilder
rsync = %s
"""
class FetchBuilderTests(TitoGitTestFixture):
def setUp(self):
@ -97,4 +98,3 @@ class FetchBuilderTests(TitoGitTestFixture):
"extsrc-0.0.2-1.*.noarch.rpm"))))
self.assertEquals(1, len(glob.glob(join(yum_repo_dir,
"repodata/repomd.xml"))))

View file

@ -34,6 +34,7 @@ builder = tito.builder.Builder
rsync = %s
"""
class YumReleaserTests(TitoGitTestFixture):
def setUp(self):
@ -68,5 +69,3 @@ class YumReleaserTests(TitoGitTestFixture):
"releaseme-0.0.1-1.*.noarch.rpm"))))
self.assertEquals(1, len(glob.glob(join(yum_repo_dir,
"repodata/repomd.xml"))))

View file

@ -79,4 +79,3 @@ class SingleProjectTests(TitoGitTestFixture):
def test_build_rpm_tag(self):
tito("build --rpm --tag=%s-0.0.1-1 -o %s" % (PKG_NAME,
self.repo_dir))

View file

@ -81,6 +81,7 @@ class CommonTests(unittest.TestCase):
self.assertEquals("fe87e2b75ed1850718d99c797cc171b88bfad5ca",
extract_sha1(ls_remote_output))
class VersionMathTest(unittest.TestCase):
def test_increase_version_minor(self):
line = "1.0.0"

View file

@ -33,8 +33,10 @@ class TestPep8(TitoUnitTestFixture):
tests = [
# http://pep8.readthedocs.org/en/latest/intro.html#error-codes
'E2', # whitespace errors
'E3', # blank line errors
'E9', # runtime errors (SyntaxError, IndentationError, IOError)
'W2', # whitespace warnings
'W3', # blank line warnings
'W6', # deprecated features
]