diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-06-26 10:01:18 +0300 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-06-30 14:14:42 +0300 |
commit | b04812b6f4e3f3859c4fd17b62ea9ed5d3bc035a (patch) | |
tree | ea5b5df4e8b3e915152d548bab1dc75c382d8cb6 | |
parent | 4e28ad9e47a2c5e68bee9685ed6aa83ea37ec4fe (diff) | |
download | git-buildpackage-b04812b6f4e3f3859c4fd17b62ea9ed5d3bc035a.tar.gz git-buildpackage-b04812b6f4e3f3859c4fd17b62ea9ed5d3bc035a.tar.bz2 git-buildpackage-b04812b6f4e3f3859c4fd17b62ea9ed5d3bc035a.zip |
ComponentTestBase: add check_files() method
Change-Id: If23365cde15c2659aad039f19984a97968cd4545
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r-- | tests/component/__init__.py | 14 | ||||
-rw-r--r-- | tests/component/rpm/test_import_orig_rpm.py | 8 |
2 files changed, 10 insertions, 12 deletions
diff --git a/tests/component/__init__.py b/tests/component/__init__.py index f029eb28..0c7e27f3 100644 --- a/tests/component/__init__.py +++ b/tests/component/__init__.py @@ -125,6 +125,15 @@ class ComponentTestBase(object): self._capture_log(False) + @staticmethod + def check_files(reference, filelist): + """Compare two file lists""" + extra = set(filelist) - set(reference) + missing = set(reference) - set(filelist) + assert_msg = "Unexpected files: %s, Missing files: %s" % \ + (list(extra), list(missing)) + assert not extra and not missing, assert_msg + @classmethod def _check_repo_state(cls, repo, current_branch, branches, files=None): """Check that repository is clean and given branches exist""" @@ -148,10 +157,7 @@ class ComponentTestBase(object): for dirname in dirnames: local.add(os.path.relpath(os.path.join(dirpath, dirname), repo.path) + '/') - extra = local - set(files) - ok_(not extra, "Unexpected files in repo: %s" % list(extra)) - missing = set(files) - local - ok_(not missing, "Files missing from repo: %s" % list(missing)) + cls.check_files(files, local) def _capture_log(self, capture=True): """ Capture log""" diff --git a/tests/component/rpm/test_import_orig_rpm.py b/tests/component/rpm/test_import_orig_rpm.py index 465c5fad..935e995f 100644 --- a/tests/component/rpm/test_import_orig_rpm.py +++ b/tests/component/rpm/test_import_orig_rpm.py @@ -96,14 +96,6 @@ class ImportOrigTestBase(ComponentTestBase): blobs = [obj[3] for obj in objs if obj[1] == 'blob'] return set(blobs) - @staticmethod - def check_files(reference, filelist): - """Compare two file lists""" - extra = set(filelist) - set(reference) - assert not extra, "Unexpected files: %s" % list(extra) - missing = set(reference) - set(filelist) - assert not missing, "Missing files: %s" % list(missing) - @classmethod def check_tree(cls, repo, treeish, filelist): """Check the contents (list of files) in a git treeish""" |