diff options
author | Guido Günther <agx@sigxcpu.org> | 2013-04-29 20:55:40 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2013-04-29 21:14:18 +0200 |
commit | 43e60bb76e80c6ca7be1ee1da582fe78c5465349 (patch) | |
tree | 415cea02d452df14d26c25344601c7be3b03fe9b /tests | |
parent | 45c2346f6a52aec196dd89b8d09d8b06d05b8867 (diff) |
Make parse_dsc a classmethod of DscFile
so we have the object creation close to the object itself.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/12_test_deb.py | 6 | ||||
-rw-r--r-- | tests/14_test_gbp_import_dscs.py | 14 |
2 files changed, 11 insertions, 9 deletions
diff --git a/tests/12_test_deb.py b/tests/12_test_deb.py index 8a35ac5f..d46f987c 100644 --- a/tests/12_test_deb.py +++ b/tests/12_test_deb.py @@ -7,6 +7,8 @@ from . import context import os, tempfile, unittest import gbp.deb + +from gbp.deb.dscfile import DscFile from gbp.command_wrappers import CommandExecFailed class TestDscFile(unittest.TestCase): @@ -51,9 +53,9 @@ Files: def tearDown(self): os.unlink(self.dscfile.name) - def test_parse_dsc_file(self): + def test_dscfile_parse(self): """Test parsing a valid dsc file""" - dsc = gbp.deb.parse_dsc(self.dscfile.name) + dsc = DscFile.parse(self.dscfile.name) self.assertEqual(dsc.version, '0.9.12-4') diff --git a/tests/14_test_gbp_import_dscs.py b/tests/14_test_gbp_import_dscs.py index 3e4772fa..9482ea8d 100644 --- a/tests/14_test_gbp_import_dscs.py +++ b/tests/14_test_gbp_import_dscs.py @@ -45,16 +45,16 @@ class DscStub(object): self.filename = filename self.version = version -def stub_parse_dsc(filename): - # filename is like file1.dsc, file2.dsc, use - # the digit as version number - version = filename[4] - return DscStub(filename, version) - + @classmethod + def parse(cls, filename): + # filename is like file1.dsc, file2.dsc, use + # the digit as version number + version = filename[4] + return cls(filename, version) # hook up stubs import_dscs.GitImportDsc = StubGitImportDsc -import_dscs.parse_dsc = stub_parse_dsc +import_dscs.DscFile = DscStub class TestImportDscs(testutils.DebianGitTestRepo): """Test L{gbp.scripts.import_dscs}'s """ |