def _create_target(self): target_class = type(self._data.data) if target_class is TestDataDirectory: target = TestDataDirectory(source=self._data.directory) target.initfile = self._data.data.initfile return target return target_class(source=self._data.source)
def _create_target(self): data = self._data.data target_class = type(data) if isinstance(data, TestDataDirectory): target = TestDataDirectory(source=self._data.directory) target.initfile = data.initfile return target return target_class(source=self._data.source)
def load_data(root_path): global DATA if DATA is None: suite = TestDataDirectory(source=root_path) suite.populate() resource_files = load_resource_files(suite) libraries = load_libraries(suite, resource_files) DATA = Project(suite, resource_files, libraries) return DATA
def testcase_controller(project=None, data=None): if data is None: data = BASE_DATA[:] base_directory_controller = TestDataDirectoryController( TestDataDirectory(), project) directory_controller = TestDataDirectoryController( TestDataDirectory(), project, base_directory_controller) tcf_controller = TestCaseFileController(create(data), project, directory_controller) tctablectrl = tcf_controller.tests return tctablectrl[0]
def test_deleting_init_file(self): chief = create_chief() chief._controller = TestDataDirectoryController( TestDataDirectory(source=self._dirpath).populate(), chief) os.remove(self._init_path) chief.data.remove() open(self._init_path, 'w').write('*Settings*\nDocumentation Ride unit testing file\n') assert_true(chief.data.has_format() is False, chief.data.data.initfile)
def test_deleting_file_suite_under_dir_suite(self): chief = create_chief() chief._controller = TestDataDirectoryController( TestDataDirectory(source=self._dirpath).populate(), chief) original_children_length = len(chief.data.children) file_suite = chief.data.children[0] file_suite.remove() assert_true( len(chief.data.children) == original_children_length - 1, 'Child suite was not removed')
def test_reload_with_directory_suite(self): model_parent = object() controller_parent = object() ctrl = TestDataDirectoryController(TestDataDirectory( source=self._dirpath, parent=model_parent).populate(), parent=controller_parent) open(self._init_path, 'a').write('... ninjaed more documentation') ctrl.reload() assert_equals(ctrl.settings[0].value, 'Ride unit testing file\\nninjaed more documentation') assert_equals(ctrl.parent, controller_parent) assert_equals(ctrl.data.parent, model_parent)
def test_resource_kws_only_once(self): directory = TestDataDirectory(source=SIMPLE_TEST_SUITE_PATH).populate() all_kws = self.ns.get_all_keywords(directory.children) self._check_resource_keyword_only_once(all_kws)
def NewTestDataDirectory(path): dirname = os.path.dirname(path) datafile = TestDataDirectory(source=dirname) datafile.initfile = path _create_missing_directories(dirname) return datafile
def __init__(self, parent, source, settings): self._settings = settings TestDataDirectory.__init__(self, parent, source)
def _run(self): result = TestDataDirectory(source=os.path.dirname(self._path)) result.initfile = self._path FromFilePopulator(result).populate(self._path) return result
def __init__(self, parent, path): self._parent = parent self._path = path TestDataDirectory.__init__(self, parent, path)
def test_mtime_with_directory_suite(self): ctrl = TestDataDirectoryController( TestDataDirectory(source=self._dirpath).populate()) assert_false(ctrl.has_been_modified_on_disk()) os.utime(self._init_path, (1, 1)) assert_true(ctrl.has_been_modified_on_disk())
def _data_directory(path): data = TestDataDirectory() data.source = data.directory = os.path.normpath(path) return data