[pygobject] tests: Make get_all_dependendencies() test more robust
- From: Simon Feltman <sfeltman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] tests: Make get_all_dependendencies() test more robust
- Date: Sat, 21 Feb 2015 05:59:35 +0000 (UTC)
commit d8961622ea748c42171bdb4703e70022035ec3cc
Author: Simon Feltman <sfeltman src gnome org>
Date: Fri Feb 20 21:52:58 2015 -0800
tests: Make get_all_dependendencies() test more robust
Replace array comparison with checking if individual items are in the array.
This solves a problem where the returned array might be in a different order
as well as future proofs the test in case more dependencies are added.
tests/test_import_machinery.py | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/tests/test_import_machinery.py b/tests/test_import_machinery.py
index c3d2a0b..a1adab1 100644
--- a/tests/test_import_machinery.py
+++ b/tests/test_import_machinery.py
@@ -120,10 +120,12 @@ class TestImporter(unittest.TestCase):
def test__get_all_dependencies(self):
get_all_dependencies = gi.importer._get_all_dependencies
+ deps = set(get_all_dependencies("Regress"))
- self.assertEqual(
- get_all_dependencies("Regress"),
- ['Gio-2.0', 'GObject-2.0', 'GLib-2.0', 'cairo-1.0'])
+ self.assertTrue('Gio-2.0' in deps)
+ self.assertTrue('GObject-2.0' in deps)
+ self.assertTrue('GLib-2.0' in deps)
+ self.assertTrue('cairo-1.0' in deps)
def test_require_version_warning(self):
check = gi.importer._check_require_version
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]