summaryrefslogtreecommitdiff
path: root/tests/test_Changelog.py
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-04-03 15:29:19 +0300
committerGuido Günther <agx@sigxcpu.org>2013-04-26 22:07:15 +0200
commitf880910c80c30bf64f951bb054814d2e00e76b77 (patch)
treea18da537a857d09ac8fb4c66c850e792d42c9c3c /tests/test_Changelog.py
parentae63dba9f6d2fe2d1c0889b69eccacb3fc256a9c (diff)
tests: Fix tests for Ubuntu
On Ubuntu dch produces different version numbering. Adapt tests for this. Adds a jew class to parse '/etc/lsb-release' to determine the distribution and it's codename to dynamically adapt tests accordingly. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests/test_Changelog.py')
-rw-r--r--tests/test_Changelog.py28
1 files changed, 18 insertions, 10 deletions
diff --git a/tests/test_Changelog.py b/tests/test_Changelog.py
index d0572c1..55cbcad 100644
--- a/tests/test_Changelog.py
+++ b/tests/test_Changelog.py
@@ -238,6 +238,8 @@ def test_add_section():
>>> import tempfile
>>> import shutil
>>> import gbp.deb.changelog
+ >>> from tests.testutils import OsReleaseFile
+ >>> os_release = OsReleaseFile('/etc/lsb-release')
>>> olddir = os.path.abspath(os.path.curdir)
>>> testdir = tempfile.mkdtemp(prefix='gbp-test-changelog-')
>>> testdebdir = os.path.join(testdir, 'debian')
@@ -252,11 +254,13 @@ def test_add_section():
>>> cl = gbp.deb.changelog.ChangeLog(filename=testclname)
>>> cl.add_section(msg=["Test add section"], distribution=None, author="Debian Maintainer", email="maint@debian.org")
>>> cl = gbp.deb.changelog.ChangeLog(filename=testclname)
- >>> cl.version
- '0.5.33'
- >>> cl.debian_version
- '0.5.33'
- >>> cl['Distribution'] in ['UNRELEASED', 'unstable']
+ >>> version = '0.5.32ubuntu1' if os_release['DISTRIB_ID'] == 'Ubuntu' else '0.5.33'
+ >>> cl.version == version
+ True
+ >>> cl.debian_version == version
+ True
+ >>> distributions = ['UNRELEASED', os_release['DISTRIB_CODENAME'] or 'unstable']
+ >>> cl['Distribution'] in distributions
True
>>> 'Test add section' in cl['Changes']
True
@@ -280,6 +284,8 @@ def test_add_entry():
>>> import tempfile
>>> import shutil
>>> import gbp.deb.changelog
+ >>> from tests.testutils import OsReleaseFile
+ >>> os_release = OsReleaseFile('/etc/lsb-release')
>>> olddir = os.path.abspath(os.path.curdir)
>>> testdir = tempfile.mkdtemp(prefix='gbp-test-changelog-')
>>> testdebdir = os.path.join(testdir, 'debian')
@@ -295,11 +301,13 @@ def test_add_entry():
>>> cl.add_section(msg=["Test add section"], distribution=None, author="Debian Maintainer", email="maint@debian.org")
>>> cl.add_entry(msg=["Test add entry"], author="Debian Maintainer", email="maint@debian.org")
>>> cl = gbp.deb.changelog.ChangeLog(filename=testclname)
- >>> cl.version
- '0.5.33'
- >>> cl.debian_version
- '0.5.33'
- >>> cl['Distribution'] in ['UNRELEASED', 'unstable']
+ >>> version = '0.5.32ubuntu1' if os_release['DISTRIB_ID'] == 'Ubuntu' else '0.5.33'
+ >>> cl.version == version
+ True
+ >>> cl.debian_version == version
+ True
+ >>> distributions = ['UNRELEASED', os_release['DISTRIB_CODENAME'] or 'unstable']
+ >>> cl['Distribution'] in distributions
True
>>> 'Test add entry' in cl['Changes']
True