本文整理汇总了Python中robotide.controller.ChiefController.resource_import_modified方法的典型用法代码示例。如果您正苦于以下问题:Python ChiefController.resource_import_modified方法的具体用法?Python ChiefController.resource_import_modified怎么用?Python ChiefController.resource_import_modified使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类robotide.controller.ChiefController
的用法示例。
在下文中一共展示了ChiefController.resource_import_modified方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ChiefControllerTest
# 需要导入模块: from robotide.controller import ChiefController [as 别名]
# 或者: from robotide.controller.ChiefController import resource_import_modified [as 别名]
#.........这里部分代码省略.........
def _get_paths(self, data):
return [item.path for item in data]
def test_loading_resource_at_startup(self):
self._load(RESOURCE_PATH)
assert_true(self.ctrl.resources != [])
self._test_listeners([], ALL_RESOURCE_PATH_RELATED_RESOURCE_IMPORTS)
def test_loading_invalid_data_at_startup(self):
msg = "Given file 'invalid' is not a valid Robot Framework test case or resource file."
self.ctrl.load_data('invalid', self.load_observer)
assert_true(self.load_observer.finished)
assert_equals(self.load_observer.message, msg)
self._test_listeners([], [])
def _load(self, path):
self.ctrl.load_data(path, self.load_observer)
assert_true(self.load_observer.notified)
assert_true(self.load_observer.finished)
def test_loading_datafile(self):
data = self.ctrl.load_datafile(MINIMAL_SUITE_PATH, self.load_observer)
assert_true(self.load_observer.finished)
assert_true(data is not None)
self._test_listeners([MINIMAL_SUITE_PATH], [])
def test_reloading(self):
self.ctrl.new_file_project(MINIMAL_SUITE_PATH)
files1 = self.ctrl.datafiles
self.ctrl.new_file_project(MINIMAL_SUITE_PATH)
files2 = self.ctrl.datafiles
assert_true(files1 != files2)
def test_loading_resource_file(self):
resource = self.ctrl.load_resource(RESOURCE_PATH, self.load_observer)
assert_true(self.load_observer.finished)
assert_true(resource is not None)
self._test_listeners([], ALL_RESOURCE_PATH_RELATED_RESOURCE_IMPORTS)
def test_loading_invalid_datafile(self):
self.ctrl.load_datafile('invalid', self.load_observer)
assert_equals(self.load_observer.message, "Invalid data file 'invalid'.")
self._test_listeners([], [])
def test_loading_invalid_resource(self):
assert_none(self.ctrl.load_resource('invalid', self.load_observer))
assert_equals(self.load_observer.message, "Invalid resource file 'invalid'.")
self._test_listeners([], [])
def test_dirtyness(self):
self.ctrl.load_data(COMPLEX_SUITE_PATH, MessageRecordingLoadObserver())
assert_true(not self.ctrl.is_dirty())
self.ctrl.data.create_test('newnessness')
assert_true(self.ctrl.is_dirty())
def test_load_dirty_controllers(self):
self.ctrl.load_data(SUITEPATH, MessageRecordingLoadObserver())
assert_equals(len(self.ctrl._get_all_dirty_controllers()), 0)
tcf = self._find_suite_by_type(self.ctrl.data.children, TestCaseFileController)
tcf.create_test('newnessness')
assert_equals(len(self.ctrl._get_all_dirty_controllers()), 1)
self.ctrl.data.mark_dirty()
assert_equals(len(self.ctrl._get_all_dirty_controllers()), 2)
sub_dir = self._find_suite_by_type(self.ctrl.data.children, TestDataDirectoryController)
sub_dir_tcf = self._find_suite_by_type(sub_dir.children, TestCaseFileController)
sub_dir_tcf.create_test('newnessness')
assert_equals(len(self.ctrl._get_all_dirty_controllers()), 3)
def _find_suite_by_type(self, suites, type):
for child in suites:
if isinstance(child, type):
return child
return None
def test_creating_new_resource(self):
controller = self.ctrl.new_resource('somepath')
assert_equals(controller.name, 'Somepath')
def test_resource_with_same_path_is_not_added_twice(self):
self.ctrl.new_resource('somepath')
self.ctrl.new_resource('somepath')
assert_equals(len(self.ctrl.resources), 1)
def test_sort_external_resources(self):
self.ctrl.load_data(EXTERNAL_RES_UNSORTED_PATH, MessageRecordingLoadObserver())
assert_equals([res.name for res in self.ctrl.external_resources], ["Abc", "Bar", "Foo", "Hello", "Resource"])
def test_datafiles_property_with_resource_file_only(self):
resource = self.ctrl.load_resource(RESOURCE_PATH, self.load_observer)
assert_equals(self.ctrl.datafiles[0], resource)
def test_get_all_keywords_with_resource_file_only(self):
chief = datafilereader.construct_chief_controller(RESOURCE_PATH)
all_kws = chief.get_all_keywords()
res_kws = [kw for kw in all_kws if kw.name == 'Resource UK']
assert_equals(len(res_kws), 1)
def test_resource_import_modified(self):
self.ctrl.resource_import_modified(RELATIVE_PATH_TO_RESOURCE_FILE, DATAPATH)
self._test_listeners([], ALL_RESOURCE_PATH_RELATED_RESOURCE_IMPORTS)