diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2015-11-27 16:11:07 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2015-12-02 18:50:32 +0100 |
commit | bcc111def92598c0d6093c8a973b552707d7e544 (patch) | |
tree | d1c1f0c592942bcf4a16f020f842c77966cb85d8 /tests | |
parent | af17809dca74afc87746382e6d0bed1f747ab769 (diff) |
tests: include test case name into tmpdir name
This makes test debugging much easier.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/component/__init__.py | 16 | ||||
-rw-r--r-- | tests/component/rpm/__init__.py | 4 | ||||
-rw-r--r-- | tests/component/rpm/test_import_srpm.py | 8 |
3 files changed, 15 insertions, 13 deletions
diff --git a/tests/component/__init__.py b/tests/component/__init__.py index 64348481..02c4829c 100644 --- a/tests/component/__init__.py +++ b/tests/component/__init__.py @@ -23,6 +23,7 @@ Module for testing individual command line tools of the git-buildpackage suite import os import shutil import tempfile +import unittest from nose import SkipTest from nose.tools import eq_, ok_ # pylint: disable=E0611 from .. testutils import GbpLogTester @@ -80,11 +81,11 @@ class ComponentTestGitRepository(GitRepository): return set(blobs) -class ComponentTestBase(GbpLogTester): +class ComponentTestBase(unittest.TestCase, GbpLogTester): """Base class for testing cmdline tools of git-buildpackage""" @classmethod - def setup_class(cls): + def setUpClass(cls): """Test class case setup""" # Don't let git see that we're (possibly) under a git directory cls.orig_env = os.environ.copy() @@ -98,7 +99,7 @@ class ComponentTestBase(GbpLogTester): '%(top_dir)s/debian/gbp.conf:%(git_dir)s/gbp.conf' @classmethod - def teardown_class(cls): + def tearDownClass(cls): """Test class case teardown""" # Return original environment os.environ.clear() @@ -107,23 +108,24 @@ class ComponentTestBase(GbpLogTester): if not os.getenv("GBP_TESTS_NOCLEAN"): shutil.rmtree(cls._tmproot) - def __init__(self): + def __init__(self, methodName='runTest'): """Object initialization""" self._orig_dir = None self._tmpdir = None + unittest.TestCase.__init__(self, methodName) GbpLogTester.__init__(self) - def setup(self): + def setUp(self): """Test case setup""" # Change to a temporary directory self._orig_dir = os.getcwd() - self._tmpdir = tempfile.mkdtemp(prefix='gbp_%s_' % __name__, + self._tmpdir = tempfile.mkdtemp(prefix='tmp_%s_' % self._testMethodName, dir=self._tmproot) os.chdir(self._tmpdir) self._capture_log(True) - def teardown(self): + def tearDown(self): """Test case teardown""" # Restore original working dir os.chdir(self._orig_dir) diff --git a/tests/component/rpm/__init__.py b/tests/component/rpm/__init__.py index ad229eae..c44c81b3 100644 --- a/tests/component/rpm/__init__.py +++ b/tests/component/rpm/__init__.py @@ -38,9 +38,9 @@ class RpmRepoTestBase(ComponentTestBase): """Baseclass for tests run in a Git repository with packaging data""" @classmethod - def setup_class(cls): + def setUpClass(cls): """Initializations only made once per test run""" - super(RpmRepoTestBase, cls).setup_class() + super(RpmRepoTestBase, cls).setUpClass() # Initialize test data repositories cmd = Command('./manage.py', cwd=RPM_TEST_DATA_DIR, capture_stderr=True) diff --git a/tests/component/rpm/test_import_srpm.py b/tests/component/rpm/test_import_srpm.py index 5c19d44f..31a18a5f 100644 --- a/tests/component/rpm/test_import_srpm.py +++ b/tests/component/rpm/test_import_srpm.py @@ -217,8 +217,8 @@ class TestImportPacked(ComponentTestBase): class TestImportUnPacked(ComponentTestBase): """Test importing of unpacked source rpms""" - def setup(self): - super(TestImportUnPacked, self).setup() + def setUp(self): + super(TestImportUnPacked, self).setUp() # Unpack some source rpms os.mkdir('multi-unpack') for pkg in ['gbp-test-1.0-1.src.rpm', 'gbp-test2-2.0-0.src.rpm']: @@ -297,11 +297,11 @@ class TestPristineTar(ComponentTestBase): """Test importing with pristine-tar""" @classmethod - def setup_class(cls): + def setUpClass(cls): if not os.path.exists('/usr/bin/pristine-tar'): raise SkipTest('Skipping %s:%s as pristine-tar tool is not ' 'available' % (__name__, cls.__name__)) - super(TestPristineTar, cls).setup_class() + super(TestPristineTar, cls).setUpClass() def test_basic_import_pristine_tar(self): """Test importing of non-native src.rpm, with pristine-tar""" |