feat(cth-suite): use cheaper heuristic for schema modules

This commit is contained in:
Andrew Mayorov 2024-01-30 21:07:40 +01:00
parent 8f2a4f7b19
commit 24dfa41722
No known key found for this signature in database
GPG Key ID: 2837C62ACFBFED5D
1 changed files with 6 additions and 3 deletions

View File

@ -470,9 +470,12 @@ clean_suite_state() ->
app_schema(App) ->
Mod = list_to_atom(atom_to_list(App) ++ "_schema"),
try is_list(Mod:roots()) of
true -> {ok, Mod};
false -> {error, schema_no_roots}
try
Exports = Mod:module_info(exports),
case lists:member({roots, 0}, Exports) of
true -> {ok, Mod};
false -> {error, schema_no_roots}
end
catch
error:undef ->
{error, schema_not_found}