()
| 1248 | |
| 1249 | |
| 1250 | def test_coverage(): |
| 1251 | from checkpointing.test_dali_stateless_operators import stateless_signed_off |
| 1252 | |
| 1253 | tested_ops = ( |
| 1254 | stateless_signed_off.tested_ops |
| 1255 | | reader_signed_off.tested_ops |
| 1256 | | random_signed_off.tested_ops |
| 1257 | ) |
| 1258 | |
| 1259 | excluded_ops = unsupported_readers + unsupported_ops |
| 1260 | |
| 1261 | fn_ops = module_functions( |
| 1262 | fn, remove_prefix="nvidia.dali.fn", allowed_private_modules=["_conditional"] |
| 1263 | ) |
| 1264 | assert len(fn_ops), "There should be some DALI ops in the `fn`, got nothing" |
| 1265 | if excluded_ops: |
| 1266 | exclude = "|".join( |
| 1267 | "(^" + pattern.replace(".", r"\.").replace("*", ".*").replace("?", ".") + "$)" |
| 1268 | for pattern in excluded_ops |
| 1269 | ) |
| 1270 | exclude = re.compile(exclude) |
| 1271 | fn_ops = [x for x in fn_ops if not exclude.match(x)] |
| 1272 | not_covered = sorted(list(set(fn_ops) - tested_ops)) |
| 1273 | not_covered_str = ",\n".join(f"'{op_name}'" for op_name in not_covered) |
| 1274 | # we are fine with covering more we can easily list, like numba |
| 1275 | assert ( |
| 1276 | set(fn_ops).difference(tested_ops) == set() |
| 1277 | ), f"Test doesn't cover {len(not_covered)} ops:\n{not_covered_str}" |
nothing calls this directly
no test coverage detected