diff options
author | Guido Günther <agx@sigxcpu.org> | 2016-12-07 11:52:51 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2016-12-07 11:55:57 +0100 |
commit | d625c205feb5ff0609a3cc34bc96db4c22f4d2b1 (patch) | |
tree | b24c47e7bf16ce76416a7dad3f8abdb6c8ddc4d4 | |
parent | 09dac7b1f389f84cb24cb3b0fb29aa48104b3514 (diff) |
tests/*rpm*: flake8 clean
-rw-r--r-- | setup.cfg | 2 | ||||
-rw-r--r-- | tests/20_test_rpm.py | 18 | ||||
-rw-r--r-- | tests/test_rpm_changelog.py | 10 |
3 files changed, 16 insertions, 14 deletions
@@ -18,4 +18,4 @@ modules = gbp, tests/test_*.py # E265: block comment should start with '# ' ignore=E501,E265 builtins=unicode,execfile,raw_input -exclude=gbp/rpm,tests/*rpm*,tests/component/rpm/,svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg +exclude=gbp/rpm,tests/component/rpm/,svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg diff --git a/tests/20_test_rpm.py b/tests/20_test_rpm.py index f7e09f45..61675a84 100644 --- a/tests/20_test_rpm.py +++ b/tests/20_test_rpm.py @@ -20,7 +20,7 @@ import filecmp import os import shutil import tempfile -from nose.tools import assert_raises, eq_, ok_ # pylint: disable=E0611 +from nose.tools import assert_raises, eq_, ok_ # pylint: disable=E0611 import six @@ -60,6 +60,7 @@ class RpmTestBase(object): """Test case teardown""" shutil.rmtree(self.tmpdir) + class TestSrcRpmFile(RpmTestBase): """Test L{gbp.rpm.SrcRpmFile}""" @@ -85,7 +86,8 @@ class TestSrcRpmFile(RpmTestBase): for fn in ['gbp-test-1.0.tar.bz2', 'foo.txt', 'bar.tar.gz', 'my.patch', 'my2.patch', 'my3.patch']: ok_(os.path.exists(os.path.join(self.tmpdir, fn)), - "%s not found" % fn) + "%s not found" % fn) + class TestSpecFile(RpmTestBase): """Test L{gbp.rpm.SpecFile}""" @@ -250,7 +252,7 @@ class TestSpecFile(RpmTestBase): spec.protected('_delete_special_macro')('invalidmacro', 0) with assert_raises(GbpError): spec.protected('_set_special_macro')('invalidmacro', 0, 'args', - prev) + prev) # Check resulting spec file spec.write_spec_file() @@ -307,7 +309,7 @@ class TestSpecFile(RpmTestBase): rval = 'my_%s' % name if rval: eq_(val['value'], rval, ("'%s:' is '%s', expecting '%s'" % - (name, val['value'], rval))) + (name, val['value'], rval))) eq_(spec.ignorepatches, []) # Check patch numbers and patch filenames patches = {} @@ -344,15 +346,15 @@ class TestSpecFile(RpmTestBase): eq_(files, ['05.patch', '01.patch']) # Also ignored patches are returned in the correct order files = [os.path.basename(patch.path) for patch in - spec.patchseries(ignored=True)] + spec.patchseries(ignored=True)] eq_(files, ['05.patch', '02.patch', '01.patch']) # Unapplied patches are added to the end of the series files = [os.path.basename(patch.path) for patch in - spec.patchseries(unapplied=True)] + spec.patchseries(unapplied=True)] eq_(files, ['05.patch', '01.patch', '03.patch']) # Return all patches (for which tag is found) files = [os.path.basename(patch.path) for patch in - spec.patchseries(unapplied=True, ignored=True)] + spec.patchseries(unapplied=True, ignored=True)] eq_(files, ['05.patch', '02.patch', '01.patch', '03.patch', '04.patch']) @@ -371,7 +373,7 @@ class TestUtilityFunctions(RpmTestBase): guess_spec(SPEC_DIR, recursive=False) # Spec found spec = guess_spec(SPEC_DIR, recursive=False, - preferred_name = 'gbp-test2.spec') + preferred_name='gbp-test2.spec') eq_(spec.specfile, 'gbp-test2.spec') eq_(spec.specdir, SPEC_DIR) diff --git a/tests/test_rpm_changelog.py b/tests/test_rpm_changelog.py index 3e748044..7ae7b809 100644 --- a/tests/test_rpm_changelog.py +++ b/tests/test_rpm_changelog.py @@ -31,14 +31,14 @@ class TestChangelogHeader(object): def test_str_format(self): """Basic test for header""" - time = datetime(2014, 01, 29, 12, 13, 14) + time = datetime(2014, 1, 29, 12, 13, 14) header = _ChangelogHeader(RpmPkgPolicy, time, name="John Doe", email="user@host.com", revision="1") eq_(str(header), "* Wed Jan 29 2014 John Doe <user@host.com> 1\n") def test_str_format_err(self): """Test missing properties""" - time = datetime(2014, 01, 29, 12, 13, 14) + time = datetime(2014, 1, 29, 12, 13, 14) header = _ChangelogHeader(RpmPkgPolicy, time, name="John", revision="1") with assert_raises(ChangelogError): str(header) @@ -70,7 +70,7 @@ class TestChangelogSection(object): def setup(self): """Initialize test""" - time = datetime(2014, 01, 29, 12, 13, 14) + time = datetime(2014, 1, 29, 12, 13, 14) self.default_sect = _ChangelogSection(RpmPkgPolicy, time, name="J. D.", email="u@h", revision="1") entry = _ChangelogEntry(RpmPkgPolicy, "J. D.", "- my change") @@ -94,7 +94,7 @@ class TestChangelogSection(object): def test_set_header(self): """Test set_header() method""" section = self.default_sect - time = datetime(2014, 01, 30) + time = datetime(2014, 1, 30) section.set_header(time=time, name="Jane", email="u@h", revision="1.1") eq_(str(section), "* Thu Jan 30 2014 Jane <u@h> 1.1\n- my change\n\n") @@ -219,7 +219,7 @@ class TestChangelog(object): def test_add_section(self): """Test the add_section() method""" changelog = Changelog(RpmPkgPolicy) - time = datetime(2014, 01, 30) + time = datetime(2014, 1, 30) new_section = changelog.add_section(time=time, name="Jane Doe", email="j@doe.com", revision="1.2") eq_(str(changelog), "* Thu Jan 30 2014 Jane Doe <j@doe.com> 1.2\n\n") |