MCPcopy Create free account
hub / github.com/NVIDIA/DALI / test_coverage

Function test_coverage

dali/test/python/checkpointing/test_dali_checkpointing.py:1250–1277  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1248
1249
1250def 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}"

Callers

nothing calls this directly

Calls 2

module_functionsFunction · 0.90
matchMethod · 0.80

Tested by

no test coverage detected