#
from collections import OrderedDict
+import glob
import os
import sys
from patman import tools
return node
return None
+def GetEntryModules(include_testing=True):
+ """Get a set of entry class implementations
+
+ Returns:
+ Set of paths to entry class filenames
+ """
+ our_path = os.path.dirname(os.path.realpath(__file__))
+ glob_list = glob.glob(os.path.join(our_path, 'etype/*.py'))
+ return set([os.path.splitext(os.path.basename(item))[0]
+ for item in glob_list
+ if include_testing or '_testing' not in item])
+
def WriteEntryDocs(modules, test_missing=None):
"""Write out documentation for all entries
from binman import elf
from binman import elf_test
from binman import fmap_util
-from binman import main
from binman import state
from dtoc import fdt
from dtoc import fdt_util
def testEntryDocs(self):
"""Test for creation of entry documentation"""
with test_util.capture_sys_output() as (stdout, stderr):
- control.WriteEntryDocs(main.GetEntryModules())
+ control.WriteEntryDocs(control.GetEntryModules())
self.assertTrue(len(stdout.getvalue()) > 0)
def testEntryDocsMissing(self):
"""Test handling of missing entry documentation"""
with self.assertRaises(ValueError) as e:
with test_util.capture_sys_output() as (stdout, stderr):
- control.WriteEntryDocs(main.GetEntryModules(), 'u_boot')
+ control.WriteEntryDocs(control.GetEntryModules(), 'u_boot')
self.assertIn('Documentation is missing for modules: u_boot',
str(e.exception))
"""See README for more information"""
from distutils.sysconfig import get_python_lib
-import glob
import os
import site
import sys
return test_util.ReportResult('binman', test_name, result)
-def GetEntryModules(include_testing=True):
- """Get a set of entry class implementations
-
- Returns:
- Set of paths to entry class filenames
- """
- glob_list = glob.glob(os.path.join(our_path, 'etype/*.py'))
- return set([os.path.splitext(os.path.basename(item))[0]
- for item in glob_list
- if include_testing or '_testing' not in item])
-
def RunTestCoverage(toolpath):
"""Run the tests and check that we get 100% coverage"""
- glob_list = GetEntryModules(False)
+ glob_list = control.GetEntryModules(False)
all_set = set([os.path.splitext(os.path.basename(item))[0]
for item in glob_list if '_testing' not in item])
extra_args = ''
args.toolpath)
elif args.cmd == 'entry-docs':
- control.WriteEntryDocs(GetEntryModules())
+ control.WriteEntryDocs(control.GetEntryModules())
else:
try: