From 57c099e9259a34c274836f96024bbb84563486d4 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Tue, 28 Nov 2017 08:13:13 +0100 Subject: DebianSource: add test for workdir != toplevel debian dir Gbp-Dch: Ignore --- tests/15_test_DebianSource.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') diff --git a/tests/15_test_DebianSource.py b/tests/15_test_DebianSource.py index 06ffb78b..809feaac 100644 --- a/tests/15_test_DebianSource.py +++ b/tests/15_test_DebianSource.py @@ -118,3 +118,26 @@ class TestDebianSource(testutils.DebianGitTestRepo): source = DebianSource('.') self.assertIsNotNone(source.control) self.assertEquals(source.control.name, "foo") + + def test_cur_dir_not_toplevel(self): + """ + Check if we can parse files if workdir != debian toplevel dir + """ + os.makedirs('debian/') + with open('debian/changelog', 'w') as f: + f.write("""foo (0.2.3) unstable; urgency=low + + * git doesn't like '~' in tag names so replace this with a dot when tagging + + -- Guido Guenther Mon, 2 Oct 2006 18:30:20 +0200 +""") + with open('debian/control', 'w') as f: + f.write("Source: foo") + os.chdir('debian/') + source = DebianSource('..') + self.assertEquals(source.changelog.name, "foo") + self.assertEquals(source.control.name, "foo") + + source = DebianSource(os.path.abspath('..')) + self.assertEquals(source.changelog.name, "foo") + self.assertEquals(source.control.name, "foo") -- cgit v1.2.3