This commit is contained in:
@@ -47,18 +47,13 @@ def test_import_logging_multiple_modules(capfd):
|
||||
logcfg("TRACE")
|
||||
setup_import_logging()
|
||||
|
||||
import json
|
||||
import math
|
||||
import io
|
||||
import random
|
||||
import json # duplicate
|
||||
import math # duplicate
|
||||
import random # duplicate
|
||||
modules_to_test = ["json", "math", "io", "random"]
|
||||
for name in modules_to_test:
|
||||
importlib.reload(__import__(name))
|
||||
|
||||
out, err = capfd.readouterr()
|
||||
|
||||
expected_imports = {"json", "math", "io", "random"}
|
||||
for mod in expected_imports:
|
||||
for mod in modules_to_test:
|
||||
assert f"importing: {mod}" in err, f"Missing import log for {mod}"
|
||||
|
||||
assert err.count("importing: json") == 1
|
||||
|
||||
Reference in New Issue
Block a user