|
22 | 22 | import_nonexistent_module_test/1, |
23 | 23 | import_nonexistent_function_test/1, |
24 | 24 | import_idempotent_test/1, |
25 | | - import_stats_test/1, |
26 | 25 | import_list_test/1, |
27 | 26 | import_speeds_up_calls_test/1, |
28 | 27 | import_multiprocess_test/1, |
@@ -55,7 +54,6 @@ groups() -> |
55 | 54 | import_nonexistent_module_test, |
56 | 55 | import_nonexistent_function_test, |
57 | 56 | import_idempotent_test, |
58 | | - import_stats_test, |
59 | 57 | import_list_test, |
60 | 58 | import_speeds_up_calls_test, |
61 | 59 | import_multiprocess_test, |
@@ -186,34 +184,6 @@ import_idempotent_test(_Config) -> |
186 | 184 | %% Still works |
187 | 185 | {ok, _} = py:call(json, dumps, [[1]]). |
188 | 186 |
|
189 | | -%% @doc Test import stats |
190 | | -import_stats_test(_Config) -> |
191 | | - %% Start fresh |
192 | | - ok = py_import:clear_imports(), |
193 | | - |
194 | | - %% Check empty stats |
195 | | - {ok, Stats0} = py_import:import_stats(), |
196 | | - ?assertEqual(0, maps:get(count, Stats0, 0)), |
197 | | - |
198 | | - %% Import some modules |
199 | | - ok = py_import:ensure_imported(json), |
200 | | - ok = py_import:ensure_imported(math), |
201 | | - ok = py_import:ensure_imported(os), |
202 | | - |
203 | | - %% Check stats |
204 | | - {ok, Stats1} = py_import:import_stats(), |
205 | | - Count1 = maps:get(count, Stats1, 0), |
206 | | - ?assertEqual(3, Count1), |
207 | | - |
208 | | - %% Import functions |
209 | | - ok = py_import:ensure_imported(json, dumps), |
210 | | - ok = py_import:ensure_imported(json, loads), |
211 | | - |
212 | | - %% Check updated stats (3 modules + 2 functions = 5) |
213 | | - {ok, Stats2} = py_import:import_stats(), |
214 | | - Count2 = maps:get(count, Stats2, 0), |
215 | | - ?assertEqual(5, Count2). |
216 | | - |
217 | 187 | %% @doc Test listing imports |
218 | 188 | import_list_test(_Config) -> |
219 | 189 | %% Start fresh |
@@ -323,11 +293,10 @@ import_multiprocess_test(_Config) -> |
323 | 293 | ?assertEqual([done, done, done], Results), |
324 | 294 |
|
325 | 295 | %% Now verify the GLOBAL registry has all entries |
326 | | - {ok, Stats} = py_import:import_stats(), |
327 | 296 | {ok, List} = py_import:import_list(), |
328 | 297 |
|
329 | 298 | %% Total entries: json, json.dumps, math, math.sqrt, math.floor, os, os.getcwd, string = 8 |
330 | | - ?assertEqual(8, maps:get(count, Stats)), |
| 299 | + ?assertEqual(8, length(py_import:all_imports())), |
331 | 300 |
|
332 | 301 | %% Verify all modules are in the shared registry |
333 | 302 | ?assert(maps:is_key(<<"json">>, List)), |
@@ -383,8 +352,7 @@ import_concurrent_stress_test(_Config) -> |
383 | 352 | end, Results), |
384 | 353 |
|
385 | 354 | %% Verify the global registry has all modules |
386 | | - {ok, Stats} = py_import:import_stats(), |
387 | | - Count = maps:get(count, Stats), |
| 355 | + Count = length(py_import:all_imports()), |
388 | 356 | %% Should have all 10 modules (some may have been imported multiple times but ETS dedupes) |
389 | 357 | ?assertEqual(10, Count), |
390 | 358 |
|
|
0 commit comments