Checks for missing example & log an error if missing.
()
| 2079 | raise |
| 2080 | |
| 2081 | def list_missing_examples(): |
| 2082 | """Checks for missing example & log an error if missing.""" |
| 2083 | try: |
| 2084 | missing_examples = '' |
| 2085 | for file_name in os.listdir('doc/schemas'): |
| 2086 | if not file_name.endswith('.json'): |
| 2087 | continue |
| 2088 | file_name_str = str(file_name).replace('.json', '') |
| 2089 | # Log an error if the method is not in the list |
| 2090 | if file_name_str not in ALL_RPC_EXAMPLES and file_name_str not in IGNORE_RPCS_LIST: |
| 2091 | missing_examples = missing_examples + f"'{file_name_str}', " |
| 2092 | if missing_examples != '': |
| 2093 | raise MissingExampleError(f"Missing {missing_examples.count(', ')} Examples For: [{missing_examples.rstrip(', ')}]") |
| 2094 | except MissingExampleError: |
| 2095 | raise |
| 2096 | except Exception as e: |
| 2097 | logger.error(f'Error in listing missing examples: {e}') |
| 2098 | raise |
| 2099 | |
| 2100 | ALL_RPC_EXAMPLES = list_all_examples() |
| 2101 | logger.info(f'This test can reproduce examples for {len(ALL_RPC_EXAMPLES)} methods: {ALL_RPC_EXAMPLES}') |