diff options
author | Guido Günther <agx@sigxcpu.org> | 2016-09-09 10:41:19 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2016-09-12 08:52:07 +0200 |
commit | d1c163401153329363a010373cb512f8e59ef1e2 (patch) | |
tree | 4360253804301e13b626a47d3ee9b7740dc9fbec /tests/testutils | |
parent | f7db3b77c491e5f76f441a1155aa87b1e5dedde6 (diff) |
pep8/pyflakes cleanups
Diffstat (limited to 'tests/testutils')
-rw-r--r-- | tests/testutils/__init__.py | 11 | ||||
-rw-r--r-- | tests/testutils/debiangittestrepo.py | 3 | ||||
-rw-r--r-- | tests/testutils/gbplogtester.py | 1 |
3 files changed, 10 insertions, 5 deletions
diff --git a/tests/testutils/__init__.py b/tests/testutils/__init__.py index 60765af4..cc5e4cb4 100644 --- a/tests/testutils/__init__.py +++ b/tests/testutils/__init__.py @@ -1,6 +1,6 @@ # vim: set fileencoding=utf-8 : -from .. import context +from .. import context # noqa: F401 import os import shutil @@ -21,6 +21,7 @@ __all__ = ['GbpLogTester', 'DebianGitTestRepo', 'OsReleaseFile', 'MockedChangeLog', 'get_dch_default_urgency', 'capture_stderr', 'ls_dir', 'ls_tar', 'ls_zip'] + class OsReleaseFile(object): """Repesents a simple file with key-value pairs""" @@ -38,7 +39,7 @@ class OsReleaseFile(object): self._values[key] = value.strip() except IOError as err: gbp.log.info('Failed to read OS release file %s: %s' % - (filename, err)) + (filename, err)) def __getitem__(self, key): if key in self._values: @@ -54,6 +55,7 @@ class OsReleaseFile(object): def __repr__(self): return repr(self._values) + class MockedChangeLog(ChangeLog): contents = """foo (%s) experimental; urgency=low @@ -61,7 +63,7 @@ class MockedChangeLog(ChangeLog): -- Debian Maintainer <maint@debian.org> Sat, 01 Jan 2012 00:00:00 +0100""" - def __init__(self, version, changes = "a important change"): + def __init__(self, version, changes="a important change"): ChangeLog.__init__(self, contents=self.contents % (version, changes)) @@ -101,6 +103,7 @@ def ls_dir(directory, directories=True): contents.update(['%s%s' % (prefix, dname) for dname in dirs]) return contents + def ls_tar(tarball, directories=True): """List the contents of tar archive""" tmpdir = tempfile.mkdtemp() @@ -111,6 +114,7 @@ def ls_tar(tarball, directories=True): finally: shutil.rmtree(tmpdir) + def ls_zip(archive, directories=True): """List the contents of zip file""" tmpdir = tempfile.mkdtemp() @@ -120,4 +124,3 @@ def ls_zip(archive, directories=True): return ls_dir(tmpdir, directories) finally: shutil.rmtree(tmpdir) - diff --git a/tests/testutils/debiangittestrepo.py b/tests/testutils/debiangittestrepo.py index 09bf8a70..9a9ee07d 100644 --- a/tests/testutils/debiangittestrepo.py +++ b/tests/testutils/debiangittestrepo.py @@ -7,6 +7,7 @@ import unittest import gbp.deb.git + class DebianGitTestRepo(unittest.TestCase): """Scratch repo for a single unit test""" @@ -39,6 +40,6 @@ class DebianGitTestRepo(unittest.TestCase): os.makedirs(d) with open(path, 'w+') as f: - content == None or f.write(content) + content is None or f.write(content) self.repo.add_files(name, force=True) self.repo.commit_files(path, msg or "added %s" % name) diff --git a/tests/testutils/gbplogtester.py b/tests/testutils/gbplogtester.py index 3b4e92ea..6bb173f4 100644 --- a/tests/testutils/gbplogtester.py +++ b/tests/testutils/gbplogtester.py @@ -6,6 +6,7 @@ from nose.tools import ok_, assert_less import gbp.log + class GbpLogTester(object): """ Helper class for tests that need to capture logging output |