python
module_error
ai_generated
true
AttributeError: 'TestLoader' object has no attribute 'loadTestsFromName'
ID: python/unittest-testloader-error
80%Fix Rate
82%Confidence
0Evidence
2024-12-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.12 | active | — | — | — |
Root Cause
在 Python 3.12 中,TestLoader 的方法名可能已更改或已弃用
generic中文
在 Python 3.12 中,TestLoader 的方法名可能已更改或已弃用
Workarounds
-
90% success
loader = unittest.TestLoader(); suite = loader.loadTestsFromTestCase(MyTest)
-
85% success
suite = unittest.defaultTestLoader.discover('tests')
Dead Ends
Common approaches that don't work:
-
90% fail
新版本已移除
-
40% fail
失去动态加载功能