summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-03-05 17:49:56 +0200
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-11-14 14:46:24 +0200
commitdbb1ef413b9f305111b5e3bd67475c6d667ca432 (patch)
tree1b6098b9abd80fa1761932e7bb33814f0a5e1ca5
parent26cb11e290389d5611ada756dadfcd468f0866ea (diff)
downloadgit-buildpackage-dbb1ef413b9f305111b5e3bd67475c6d667ca432.tar.gz
git-buildpackage-dbb1ef413b9f305111b5e3bd67475c6d667ca432.tar.bz2
git-buildpackage-dbb1ef413b9f305111b5e3bd67475c6d667ca432.zip
CentOS compatibility: fix tests
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r--tests/01_test_help.py6
-rw-r--r--tests/02_test_upstream_source_tar_unpack.py6
-rw-r--r--tests/05_test_detection.py6
-rw-r--r--tests/06_test_upstream_source.py6
-rw-r--r--tests/08_test_patch.py6
-rw-r--r--tests/11_test_dch_main.py6
-rw-r--r--tests/12_test_deb.py7
-rw-r--r--tests/13_test_gbp_pq.py6
-rw-r--r--tests/16_test_supercommand.py6
-rw-r--r--tests/18_test_Config.py6
-rw-r--r--tests/19_test_gbp_scripts_config.py6
-rw-r--r--tests/component/rpm/test_import_srpm.py24
-rw-r--r--tests/test_import_orig.py6
-rw-r--r--tests/testutils.py6
14 files changed, 78 insertions, 25 deletions
diff --git a/tests/01_test_help.py b/tests/01_test_help.py
index 6a4810bb..a421eb8d 100644
--- a/tests/01_test_help.py
+++ b/tests/01_test_help.py
@@ -4,7 +4,11 @@
from . import context
-import unittest
+# Try unittest2 for CentOS
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
class TestHelp(unittest.TestCase):
"""Test help output of gbp commands"""
diff --git a/tests/02_test_upstream_source_tar_unpack.py b/tests/02_test_upstream_source_tar_unpack.py
index 97bf76bb..e6147abd 100644
--- a/tests/02_test_upstream_source_tar_unpack.py
+++ b/tests/02_test_upstream_source_tar_unpack.py
@@ -8,7 +8,11 @@ import os
import shutil
import tarfile
import tempfile
-import unittest
+# Try unittest2 for CentOS
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
import gbp.pkg
diff --git a/tests/05_test_detection.py b/tests/05_test_detection.py
index 126a2992..c3f729ba 100644
--- a/tests/05_test_detection.py
+++ b/tests/05_test_detection.py
@@ -4,7 +4,11 @@
from . import context
-import unittest
+# Try unittest2 for CentOS
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from gbp.scripts import buildpackage
from gbp.deb import (DebianPkgPolicy, orig_file)
diff --git a/tests/06_test_upstream_source.py b/tests/06_test_upstream_source.py
index c6df6f14..6b2a1a1e 100644
--- a/tests/06_test_upstream_source.py
+++ b/tests/06_test_upstream_source.py
@@ -9,7 +9,11 @@ import os
import shutil
import tarfile
import tempfile
-import unittest
+# Try unittest2 for CentOS
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
import zipfile
from gbp.pkg import UpstreamSource
diff --git a/tests/08_test_patch.py b/tests/08_test_patch.py
index df1d43d4..dd1532e2 100644
--- a/tests/08_test_patch.py
+++ b/tests/08_test_patch.py
@@ -5,7 +5,11 @@
from . import context
import os
-import unittest
+# Try unittest2 for CentOS
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from gbp.patch_series import Patch
diff --git a/tests/11_test_dch_main.py b/tests/11_test_dch_main.py
index dbfc25cd..9bdc5c5b 100644
--- a/tests/11_test_dch_main.py
+++ b/tests/11_test_dch_main.py
@@ -4,7 +4,11 @@
from . import context
-import unittest
+# Try unittest2 for CentOS
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from tests.testutils import (DebianGitTestRepo, OsReleaseFile,
get_dch_default_urgency)
diff --git a/tests/12_test_deb.py b/tests/12_test_deb.py
index d46f987c..2be30976 100644
--- a/tests/12_test_deb.py
+++ b/tests/12_test_deb.py
@@ -4,7 +4,12 @@
from . import context
-import os, tempfile, unittest
+import os, tempfile
+# Try unittest2 for CentOS
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
import gbp.deb
diff --git a/tests/13_test_gbp_pq.py b/tests/13_test_gbp_pq.py
index 1ae4b62a..f71c5420 100644
--- a/tests/13_test_gbp_pq.py
+++ b/tests/13_test_gbp_pq.py
@@ -19,7 +19,11 @@ from . import context
import os
import logging
-import unittest
+# Try unittest2 for CentOS
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from gbp.scripts.pq import generate_patches, switch_pq, export_patches
import gbp.scripts.common.pq as pq
diff --git a/tests/16_test_supercommand.py b/tests/16_test_supercommand.py
index f72bb562..296ef8ed 100644
--- a/tests/16_test_supercommand.py
+++ b/tests/16_test_supercommand.py
@@ -16,7 +16,11 @@
"""Test L{gbp} command wrapper"""
import sys
-import unittest
+# Try unittest2 for CentOS
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
import gbp.scripts.supercommand
class TestSuperCommand(unittest.TestCase):
diff --git a/tests/18_test_Config.py b/tests/18_test_Config.py
index f7ba8c9c..0bb7354e 100644
--- a/tests/18_test_Config.py
+++ b/tests/18_test_Config.py
@@ -1,7 +1,11 @@
# vim: set fileencoding=utf-8 :
import os
-import unittest
+# Try unittest2 for CentOS
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from gbp.config import GbpOptionParser, GbpOptionGroup
from . import context
diff --git a/tests/19_test_gbp_scripts_config.py b/tests/19_test_gbp_scripts_config.py
index f503ef54..c984329a 100644
--- a/tests/19_test_gbp_scripts_config.py
+++ b/tests/19_test_gbp_scripts_config.py
@@ -17,7 +17,11 @@
import os
import sys
-import unittest
+# Try unittest2 for CentOS
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
import gbp.scripts.config
class TestGbpConfigCommand(unittest.TestCase):
diff --git a/tests/component/rpm/test_import_srpm.py b/tests/component/rpm/test_import_srpm.py
index 5515707e..54898f7f 100644
--- a/tests/component/rpm/test_import_srpm.py
+++ b/tests/component/rpm/test_import_srpm.py
@@ -54,8 +54,8 @@ class TestImportPacked(ComponentTestBase):
eq_(mock_import(['--no-pristine-tar', srpm]), 0)
# Check repository state
repo = GitRepository('gbp-test')
- files = {'Makefile', 'README', 'bar.tar.gz', 'dummy.sh', 'foo.txt',
- 'gbp-test.spec', 'my.patch', 'mydir/myfile.txt'}
+ files = set(['Makefile', 'README', 'bar.tar.gz', 'dummy.sh', 'foo.txt',
+ 'gbp-test.spec', 'my.patch', 'mydir/myfile.txt'])
self._check_repo_state(repo, 'master', ['master', 'upstream'], files)
# Four commits: upstream, packaging files, one patch and the removal
# of imported patches
@@ -67,9 +67,9 @@ class TestImportPacked(ComponentTestBase):
eq_(mock_import(['--no-pristine-tar', srpm]), 0)
# Check repository state
repo = GitRepository('gbp-test2')
- files = {'Makefile', 'README', 'bar.tar.gz', 'dummy.sh', 'foo.txt',
+ files = set(['Makefile', 'README', 'bar.tar.gz', 'dummy.sh', 'foo.txt',
'gbp-test2.spec', 'gbp-test2-alt.spec', 'my.patch',
- 'mydir/myfile.txt'}
+ 'mydir/myfile.txt'])
self._check_repo_state(repo, 'master', ['master', 'upstream'], files)
# Four commits: upstream, packaging files, one patch and the removal
@@ -85,8 +85,8 @@ class TestImportPacked(ComponentTestBase):
eq_(mock_import(['--no-pristine-tar', '--orphan-packaging', srpm]), 0)
# Check repository state
repo = GitRepository('gbp-test2')
- files = {'bar.tar.gz', 'foo.txt', 'gbp-test2.spec',
- 'gbp-test2-alt.spec', 'my.patch', 'my2.patch', 'my3.patch'}
+ files = set(['bar.tar.gz', 'foo.txt', 'gbp-test2.spec',
+ 'gbp-test2-alt.spec', 'my.patch', 'my2.patch', 'my3.patch'])
self._check_repo_state(repo, 'master', ['master', 'upstream'], files)
# Only one commit: the packaging files
eq_(len(repo.get_commits()), 1)
@@ -96,8 +96,8 @@ class TestImportPacked(ComponentTestBase):
srpm = os.path.join(DATA_DIR, 'gbp-test-native-1.0-1.src.rpm')
eq_(mock_import(['--native', srpm]), 0)
# Check repository state
- files = {'.gbp.conf', 'Makefile', 'README', 'dummy.sh',
- 'packaging/gbp-test-native.spec'}
+ files = set(['.gbp.conf', 'Makefile', 'README', 'dummy.sh',
+ 'packaging/gbp-test-native.spec'])
repo = GitRepository('gbp-test-native')
self._check_repo_state(repo, 'master', ['master'], files)
# Only one commit: the imported source tarball
@@ -147,8 +147,8 @@ class TestImportPacked(ComponentTestBase):
eq_(len(repo.get_commits(until='upstream')), 1)
# Import new version
eq_(mock_import(['--no-pristine-tar', srpms[2]]), 0)
- files = {'Makefile', 'README', 'bar.tar.gz', 'dummy.sh', 'foo.txt',
- 'gbp-test.spec', 'my.patch', 'mydir/myfile.txt'}
+ files = set(['Makefile', 'README', 'bar.tar.gz', 'dummy.sh', 'foo.txt',
+ 'gbp-test.spec', 'my.patch', 'mydir/myfile.txt'])
self._check_repo_state(repo, 'master', ['master', 'upstream'], files)
eq_(len(repo.get_commits()), 11)
eq_(len(repo.get_commits(until='upstream')), 2)
@@ -214,10 +214,10 @@ class TestImportPacked(ComponentTestBase):
srpm]), 0)
# Check repository state
repo = GitRepository('gbp-test2')
- files = {'Makefile', 'README', 'dummy.sh', 'packaging/bar.tar.gz',
+ files = set(['Makefile', 'README', 'dummy.sh', 'packaging/bar.tar.gz',
'packaging/foo.txt', 'packaging/gbp-test2.spec',
'packaging/gbp-test2-alt.spec', 'packaging/my.patch',
- 'packaging/my2.patch', 'packaging/my3.patch'}
+ 'packaging/my2.patch', 'packaging/my3.patch'])
self._check_repo_state(repo, 'pack', ['pack', 'orig'], files)
eq_(len(repo.get_commits()), 2)
# Check packaging dir
diff --git a/tests/test_import_orig.py b/tests/test_import_orig.py
index d596d1df..aa39e380 100644
--- a/tests/test_import_orig.py
+++ b/tests/test_import_orig.py
@@ -21,7 +21,11 @@ import glob
import os
import tarfile
import tempfile
-import unittest
+# Try unittest2 for CentOS
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
from gbp.errors import GbpError
from gbp.pkg import UpstreamSource
diff --git a/tests/testutils.py b/tests/testutils.py
index 6331e12d..7cc7e361 100644
--- a/tests/testutils.py
+++ b/tests/testutils.py
@@ -7,7 +7,11 @@ import shutil
import subprocess
import tarfile
import tempfile
-import unittest
+# Try unittest2 for CentOS
+try:
+ import unittest2 as unittest
+except ImportError:
+ import unittest
import zipfile
import gbp.log