[pypy-commit] pypy gc-hooks: fix this test, and add comment explaing why it was failing
antocuni
pypy.commits at gmail.com
Thu Apr 5 13:18:22 EDT 2018
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: gc-hooks
Changeset: r94255:580dd80b842f
Date: 2018-04-05 19:17 +0200
http://bitbucket.org/pypy/pypy/changeset/580dd80b842f/
Log: fix this test, and add comment explaing why it was failing
diff --git a/pypy/module/gc/test/test_ztranslation.py b/pypy/module/gc/test/test_ztranslation.py
--- a/pypy/module/gc/test/test_ztranslation.py
+++ b/pypy/module/gc/test/test_ztranslation.py
@@ -1,4 +1,9 @@
from pypy.objspace.fake.checkmodule import checkmodule
def test_checkmodule():
- checkmodule('gc')
+ # we need to ignore GcCollectStepStats, else checkmodule fails. I think
+ # this happens because W_GcCollectStepStats.__init__ is only called from
+ # GcCollectStepHookAction.perform() and the fake objspace doesn't know
+ # about those: so, perform() is never annotated and the annotator thinks
+ # W_GcCollectStepStats has no attributes
+ checkmodule('gc', ignore=['GcCollectStepStats'])
diff --git a/pypy/objspace/fake/checkmodule.py b/pypy/objspace/fake/checkmodule.py
--- a/pypy/objspace/fake/checkmodule.py
+++ b/pypy/objspace/fake/checkmodule.py
@@ -4,6 +4,7 @@
def checkmodule(*modnames, **kwds):
translate_startup = kwds.pop('translate_startup', True)
+ ignore = set(kwds.pop('ignore', ()))
assert not kwds
config = get_pypy_config(translating=True)
space = FakeObjSpace(config)
@@ -17,6 +18,8 @@
module.init(space)
modules.append(module)
for name in module.loaders:
+ if name in ignore:
+ continue
seeobj_w.append(module._load_lazily(space, name))
if hasattr(module, 'submodules'):
for cls in module.submodules.itervalues():
More information about the pypy-commit
mailing list