本文整理汇总了Python中robotide.controller.ChiefController.is_dirty方法的典型用法代码示例。如果您正苦于以下问题:Python ChiefController.is_dirty方法的具体用法?Python ChiefController.is_dirty怎么用?Python ChiefController.is_dirty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类robotide.controller.ChiefController
的用法示例。
在下文中一共展示了ChiefController.is_dirty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ChiefControllerTest
# 需要导入模块: from robotide.controller import ChiefController [as 别名]
# 或者: from robotide.controller.ChiefController import is_dirty [as 别名]
class ChiefControllerTest(unittest.TestCase):
def setUp(self):
self.ctrl = ChiefController(Namespace())
self.load_observer = MessageRecordingLoadObserver()
self.suite_listener = PublisherListener(RideOpenSuite)
self.resource_listener = PublisherListener(RideOpenResource)
def tearDown(self):
self.suite_listener.unsubscribe()
self.resource_listener.unsubscribe()
def test_loading_suite_at_startup(self):
self._load(MINIMAL_SUITE_PATH)
assert_true(self.ctrl._controller is not None)
self._test_listeners([MINIMAL_SUITE_PATH], [])
def _test_listeners(self, suite_paths, resource_paths):
assert_equals(self._get_paths(self.suite_listener.data), suite_paths)
assert_equals(self._get_paths(self.resource_listener.data), resource_paths)
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):
#.........这里部分代码省略.........