From 2c82906d6f1a988721603e6418bd8438b29e5428 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 31 Jan 2011 14:28:12 -0800 Subject: [PATCH] ImportModulesTestCase: use iterator, not list --- pym/portage/tests/lint/test_import_modules.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pym/portage/tests/lint/test_import_modules.py b/pym/portage/tests/lint/test_import_modules.py index 87bb4bf07..8d257c5a6 100644 --- a/pym/portage/tests/lint/test_import_modules.py +++ b/pym/portage/tests/lint/test_import_modules.py @@ -13,7 +13,7 @@ class ImportModulesTestCase(TestCase): expected_failures = frozenset(( )) - for mod in self._list_modules(PORTAGE_PYM_PATH): + for mod in self._iter_modules(PORTAGE_PYM_PATH): try: __import__(mod) except ImportError as e: @@ -21,8 +21,7 @@ class ImportModulesTestCase(TestCase): self.assertTrue(False, "failed to import '%s': %s" % (mod, e)) del e - def _list_modules(self, base_dir): - all_modules = [] + def _iter_modules(self, base_dir): for parent, dirs, files in os.walk(base_dir): parent = _unicode_decode(parent, encoding=_encodings['fs'], errors='strict') @@ -38,6 +37,4 @@ class ImportModulesTestCase(TestCase): x = parent_mod else: x = parent_mod + "." + x - all_modules.append(x) - - return all_modules + yield x -- 2.26.2