summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-09-03 10:03:27 +0300
committerGuido Günther <agx@sigxcpu.org>2013-09-05 12:03:05 +0200
commit6f3d63a8024271e27d0b7e9f0d3a02dfaf94acaa (patch)
tree8d1810dc888ef1ed350f24d29aea2fcafbf5db56 /tests
parent3c0a022c975369362498f6e5a0c9417735ef2e7e (diff)
ComponentTestBase: use eq_() ok_() from nose.tools
For better assert messages. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/component/__init__.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/component/__init__.py b/tests/component/__init__.py
index e99525d8..240b721d 100644
--- a/tests/component/__init__.py
+++ b/tests/component/__init__.py
@@ -24,8 +24,8 @@ import os
import shutil
import tempfile
from StringIO import StringIO
-
from nose import SkipTest
+from nose.tools import eq_, ok_ # pylint: disable=E0611
import gbp.log
from gbp.git import GitRepository, GitRepositoryError
@@ -121,12 +121,12 @@ class ComponentTestBase(object):
def _check_repo_state(cls, repo, current_branch, branches, files=None):
"""Check that repository is clean and given branches exist"""
branch = repo.branch
- assert branch == current_branch
- assert repo.is_clean()
+ eq_(branch, current_branch)
+ ok_(repo.is_clean())
local_branches = repo.get_local_branches()
assert_msg = "Branches: expected %s, found %s" % (branches,
local_branches)
- assert set(local_branches) == set(branches), assert_msg
+ eq_(set(local_branches), set(branches), assert_msg)
if files is not None:
# Get files of the working copy recursively
local = set()
@@ -141,9 +141,9 @@ class ComponentTestBase(object):
local.add(os.path.relpath(os.path.join(dirpath, dirname),
repo.path) + '/')
extra = local - set(files)
- assert not extra, "Unexpected files in repo: %s" % list(extra)
+ ok_(not extra, "Unexpected files in repo: %s" % list(extra))
missing = set(files) - local
- assert not missing, "Files missing from repo: %s" % list(missing)
+ ok_(not missing, "Files missing from repo: %s" % list(missing))
def _capture_log(self, capture=True):
""" Capture log"""
@@ -168,10 +168,10 @@ class ComponentTestBase(object):
def _check_log(self, linenum, string):
"""Check that the specified line on log matches expectations"""
if self._log is None:
- assert False, "BUG in unittests: no log captured!"
+ raise Exception("BUG in unittests: no log captured!")
output = self._get_log()[linenum].strip()
- assert output.startswith(string), ("Expected: '%s...' Got: '%s'" %
- (string, output))
+ ok_(output.startswith(string), ("Expected: '%s...' Got: '%s'" %
+ (string, output)))
def _clear_log(self):
"""Clear the mock strerr"""