diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-06-26 10:01:18 +0300 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-12-05 15:42:55 +0100 |
commit | 0e7cb0dfa90aa34d7bf9d319d4a2abe45df3ff4f (patch) | |
tree | e35272db47ed0a0be230d25418a538b602249d2c /tests | |
parent | a84f6c1fba7772c38e810e05a1edfc909259d848 (diff) |
ComponentTestBase: add check_files() method
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/component/__init__.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/component/__init__.py b/tests/component/__init__.py index 44a84e2..ae81577 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""" |