def construct_chief_controller(datapath, temp_dir_for_excludes=None): settings = FakeSettings(temp_dir_for_excludes) library_manager = LibraryManager(':memory:') library_manager.create_database() chief = ChiefController(Namespace(settings), settings, library_manager) chief.load_data(datapath, NullObserver()) return chief
def construct_project(datapath, temp_dir_for_excludes=None): settings = FakeSettings({'excludes': temp_dir_for_excludes}) library_manager = LibraryManager(':memory:') library_manager.create_database() project = Project(Namespace(settings), settings, library_manager) project.load_data(datapath, NullObserver()) return project
def test_rename_resu_occurrence_in_case_of_double_definition(self): old_name = 'Keyword In Both Resources' new_name = 'FiiFaa' for kw in [k for k in self.resu.keywords if k.name == old_name]: self.resu.execute( RenameKeywordOccurrences(kw.name, new_name, NullObserver(), kw.info)) assert_equals(kw.name, new_name)
def test_rename_embedded_arguments_keyword_with_another_embedded_arguments_keyword(self): old_name = '2nd embedded ${args} keyword' new_name = '2nd embedded args keyword with ${trailing args}' self.assert_occurrences(self.ts3, old_name, 2) self.assert_occurrences(self.ts3, new_name, 0) self.ts3.execute(RenameKeywordOccurrences(old_name, new_name, NullObserver())) self.assert_occurrences(self.ts3, old_name, 1) self.assert_occurrences(self.ts3, new_name, 1)
def test_rename_embedded_arguments_keyword_but_dont_rename_occurrences(self): old_name = 'embedded ${args} keyword' new_name = 'unembedded keyword' self.assert_occurrences(self.ts3, old_name, 2) self.assert_occurrences(self.ts3, new_name, 0) self.ts3.execute(RenameKeywordOccurrences(old_name, new_name, NullObserver())) self.assert_occurrences(self.ts3, old_name, 1) self.assert_occurrences(self.ts3, new_name, 1)
def load_data(self, path, load_observer=None): load_observer = load_observer or NullObserver() if self._load_initfile(path, load_observer): return if self._load_datafile(path, load_observer): return if self._load_resource(path, load_observer): return load_observer.error("Given file '%s' is not a valid Robot Framework " "test case or resource file." % path)
def _rename(self, original_name, new_name, source, usage): self.test_ctrl.execute( RenameKeywordOccurrences(original_name, new_name, NullObserver())) assert_occurrence(self.test_ctrl, new_name, source, usage)
def _open(self, path): print 'project.load_data("%s", NullObserver())' % path self._project.load_data(path, NullObserver())
def _open(self, path): print 'chief.load_data("%s", NullObserver())' % path self._chief.load_data(path, NullObserver())