def setUpClass(cls):
     db_base = path.join(
         env.RESULTS_DIR,
         'database_in_package_dir')
     cls.db_dir = path.join(
         db_base,
         'db_dir'
     )
     cls.index_dir = path.join(
         db_base,
         'index_dir',
     )
     cls.suite_dir = path.join(
         env.TEST_DATA_DIR,
         'suite_tree'
     )
     if path.exists(db_base):
         shutil.rmtree(db_base)
     mkdir(db_base)
     mkdir(cls.db_dir)
     mkdir(cls.index_dir)
     scanner = Scanner()
     scanner.scan(
         cls.suite_dir,
         'robot',
         cls.db_dir)
     index_all(cls.db_dir, cls.index_dir)
     cls.rf_ext = 'robot'
Esempio n. 2
0
 def test_index_with_xml_libraries(self):
     xml_libs = os.path.join(
         env.RESOURCES_DIR,
         'library'
     )
     db_dir_with_xml = os.path.join(
         env.RESULTS_DIR,
         'db_dir_with_xml')
     scanner = Scanner(xml_libs)
     scanner.scan(
         self.suite_dir,
         'robot',
         db_dir_with_xml
     )
     index = Index(db_dir_with_xml, self.index_dir, self.xml_libs)
     index.index_consturctor(self.resource_a_table_name)
     files = os.listdir(self.index_dir)
     self.assertEqual(len(files), 1)
     with open(os.path.join(self.index_dir, files[0])) as f:
         data = json.load(f)
     self.assertTrue(
         any(kw[2] == 'SwingLibrary' for kw in data['keywords'])
     )
     self.assertTrue(
         any(kw[0] == 'Add Table Cell Selection' for kw in data['keywords'])
     )
     self.assertTrue(
         any(kw[0] == 'Select From Popup Menu' for kw in data['keywords'])
     )
 def setUp(self):
     self.scanner = Scanner()
     self.db_dir = os.path.join(env.RESULTS_DIR, 'scanner', 'db_dir')
     self.real_suite = os.path.join(env.TEST_DATA_DIR, 'real_suite')
     if os.path.exists(self.db_dir):
         while os.path.exists(self.db_dir):
             shutil.rmtree(self.db_dir)
             sleep(0.1)
         os.mkdir(self.db_dir)
     self.workspace = env.TEST_DATA_DIR
     self.builtin = ('BuiltIn', {
         'scanned': False,
         'type': 'library',
         'args': []
     })
     self.some = ('some.robot', {
         'scanned': False,
         'type': None,
         'args': []
     })
     self.resource = ('resource.robot', {
         'scanned': False,
         'type': 'resource',
         'args': []
     })
     self.xml_libs = os.path.join(env.RESOURCES_DIR, 'library')
Esempio n. 4
0
 def setUpClass(cls):
     cls.db_dir = os.path.join(
         env.RESULTS_DIR,
         'db_dir'
     )
     cls.suite_dir = os.path.join(
         env.TEST_DATA_DIR,
         'suite_tree'
     )
     scanner = Scanner()
     scanner.scan(
         cls.suite_dir,
         'robot',
         cls.db_dir)
     cls.xml_libs = os.path.join(
         env.RESOURCES_DIR,
         'library'
     )
Esempio n. 5
0
def scan_single(file_path, db_path, libs_in_xml):
    scanner = Scanner(libs_in_xml)
    scanner.scan_single_file(file_path=file_path, db_path=db_path)
Esempio n. 6
0
def scan_all(workspace, extension, db_path, module_search_path, libs_in_xml):
    for path_ in module_search_path:
        sys.path.append(path_)
    scanner = Scanner(libs_in_xml)
    scanner.scan(workspace=workspace, ext=extension, db_path=db_path)
 def setUpClass(cls):
     cls.db_dir = os.path.join(env.RESULTS_DIR, 'db_dir')
     cls.workspace = os.path.join(env.TEST_DATA_DIR, 'suite_tree')
     scanner = Scanner()
     scanner.scan(cls.workspace, 'robot', cls.db_dir)
 def test_scan_with_xml_lib(self):
     scaner = Scanner(self.xml_libs)
     scaner.scan(self.real_suite, 'robot', self.db_dir)
     self.assertEqual(len(os.listdir(self.db_dir)), 10)