def test_load_with_not_file_list(self): """Test loading method with empty file list.""" loader = DataLoader(self._summary_dir) with pytest.raises(SummaryLogPathInvalid): loader.load() assert 'No valid files can be loaded' in str( MockLogger.log_msg['warning'])
def test_load_with_invalid_file_list(self): """Test loading method with valid path and invalid file_list.""" file_list = ['summary.abc01', 'summary.abc02'] self._generate_files(self._summary_dir, file_list) loader = DataLoader(self._summary_dir) with pytest.raises(SummaryLogPathInvalid): loader.load() assert 'No valid files can be loaded' in str(MockLogger.log_msg['warning'])
def test_load_success(self): """Test loading method with valid path and file_list.""" dir_path = tempfile.NamedTemporaryFile().name if not os.path.exists(dir_path): os.mkdir(dir_path) file_list = ['summary.001', 'summary.002'] self._generate_files(dir_path, file_list) dataloader = DataLoader(dir_path) dataloader.load() assert dataloader._loader is not None shutil.rmtree(dir_path)