Gentoo Archives: gentoo-commits

From: Thomas Sachau <tommy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:multilib commit in: pym/portage/tests/lint/
Date: Sun, 06 Feb 2011 13:16:40
Message-Id: 72aa86e97367849e7dd867d0320bbf0b91c836a6.tommy@gentoo
1 commit: 72aa86e97367849e7dd867d0320bbf0b91c836a6
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jan 31 22:28:12 2011 +0000
4 Commit: Thomas Sachau <tommy <AT> gentoo <DOT> org>
5 CommitDate: Mon Jan 31 22:28:12 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=72aa86e9
7
8 ImportModulesTestCase: use iterator, not list
9
10 ---
11 pym/portage/tests/lint/test_import_modules.py | 9 +++------
12 1 files changed, 3 insertions(+), 6 deletions(-)
13
14 diff --git a/pym/portage/tests/lint/test_import_modules.py b/pym/portage/tests/lint/test_import_modules.py
15 index 87bb4bf..8d257c5 100644
16 --- a/pym/portage/tests/lint/test_import_modules.py
17 +++ b/pym/portage/tests/lint/test_import_modules.py
18 @@ -13,7 +13,7 @@ class ImportModulesTestCase(TestCase):
19 expected_failures = frozenset((
20 ))
21
22 - for mod in self._list_modules(PORTAGE_PYM_PATH):
23 + for mod in self._iter_modules(PORTAGE_PYM_PATH):
24 try:
25 __import__(mod)
26 except ImportError as e:
27 @@ -21,8 +21,7 @@ class ImportModulesTestCase(TestCase):
28 self.assertTrue(False, "failed to import '%s': %s" % (mod, e))
29 del e
30
31 - def _list_modules(self, base_dir):
32 - all_modules = []
33 + def _iter_modules(self, base_dir):
34 for parent, dirs, files in os.walk(base_dir):
35 parent = _unicode_decode(parent,
36 encoding=_encodings['fs'], errors='strict')
37 @@ -38,6 +37,4 @@ class ImportModulesTestCase(TestCase):
38 x = parent_mod
39 else:
40 x = parent_mod + "." + x
41 - all_modules.append(x)
42 -
43 - return all_modules
44 + yield x