def parse(self, folder_path): """ Searches for test files and parses them :param str folder_path: path to target folder :return int: number of found test files """ utils.check_test_folder(folder_path) m_time = self.file_scaner.scan(folder_path) if not self.file_scaner.files: raise ValueError('Nothing to parse - no test files') for filepath in self.file_scaner.files: self._test_files_structure[filepath] = self.file_parser.parse_file(filepath) self._test_files_structure.update({'m_time': m_time, 'test_folder': folder_path}) self._saves_cache() return len(self.file_scaner.files)
def test_check_test_folder_not_exists(): with pytest.raises(ValueError): utils.check_test_folder('some-test-folder')
def test_check_test_folder_not_folder(): with pytest.raises(ValueError): utils.check_test_folder('Makefile')
def test_check_test_folder(): utils.check_test_folder('tests')