TestIssues fails occasionly
frispete opened this issue · comments
During packaging deform 2.0.14, I noticed a single test failing:
[ 14s] ======================================================================
[ 14s] ERROR: test_issue_54 (deform.tests.test_form.TestIssues)
[ 14s] ----------------------------------------------------------------------
[ 14s] Traceback (most recent call last):
[ 14s] File "/home/abuild/rpmbuild/BUILD/deform-2.0.14/deform/tests/test_form.py", line 141, in test_issue_54
[ 14s] deform.Form(loginform).validate(data)
[ 14s] File "/home/abuild/rpmbuild/BUILD/deform-2.0.14/deform/field.py", line 746, in validate
[ 14s] return self.validate_pstruct(pstruct)
[ 14s] File "/home/abuild/rpmbuild/BUILD/deform-2.0.14/deform/field.py", line 788, in validate_pstruct
[ 14s] raise exception.ValidationFailure(self, cstruct, exc)
[ 14s] deform.exception.ValidationFailure
[ 14s]
[ 14s] During handling of the above exception, another exception occurred:
[ 14s]
[ 14s] Traceback (most recent call last):
[ 14s] File "/usr/lib/python3.8/site-packages/chameleon/template.py", line 192, in render
[ 14s] self._render(stream, econtext, rcontext)
[ 14s] File "form_81055aeb629be740110c84995a4f16a5.py", line 522, in render
[ 14s] File "/usr/lib/python3.8/site-packages/chameleon/zpt/template.py", line 287, in translate
[ 14s] return txl(msgid, **kwargs)
[ 14s] File "/usr/lib/python3.8/site-packages/translationstring/__init__.py", line 229, in translate
[ 14s] result = translator(tstring)
[ 14s] File "/home/abuild/rpmbuild/BUILD/deform-2.0.14/deform/tests/test_renderer.py", line 20, in translator
[ 14s] return get_localizer(get_current_request()).translate(term)
[ 14s] File "/usr/lib/python3.8/site-packages/pyramid/i18n.py", line 228, in get_localizer
[ 14s] return request.localizer
[ 14s] AttributeError: 'NoneType' object has no attribute 'localizer'
[ 14s]
[ 14s] During handling of the above exception, another exception occurred:
[ 14s]
[ 14s] Traceback (most recent call last):
[ 14s] File "/home/abuild/rpmbuild/BUILD/deform-2.0.14/deform/tests/test_form.py", line 143, in test_issue_54
[ 14s] rendered = e.render()
[ 14s] File "/home/abuild/rpmbuild/BUILD/deform-2.0.14/deform/exception.py", line 41, in render
[ 14s] return self.field.widget.serialize(self.field, self.cstruct, **kw)
[ 14s] File "/home/abuild/rpmbuild/BUILD/deform-2.0.14/deform/widget.py", line 1433, in serialize
[ 14s] return field.renderer(template, **values)
[ 14s] File "/home/abuild/rpmbuild/BUILD/deform-2.0.14/deform/template.py", line 119, in __call__
[ 14s] return self.load(template_name)(**kw)
[ 14s] File "/usr/lib/python3.8/site-packages/chameleon/template.py", line 145, in __call__
[ 14s] return self.render(**kwargs)
[ 14s] File "/usr/lib/python3.8/site-packages/chameleon/zpt/template.py", line 307, in render
[ 14s] return super(PageTemplate, self).render(**_kw)
[ 14s] File "/usr/lib/python3.8/site-packages/chameleon/template.py", line 214, in render
[ 14s] raise_with_traceback(exc, tb)
[ 14s] File "/usr/lib/python3.8/site-packages/chameleon/utils.py", line 75, in raise_with_traceback
[ 14s] raise exc
[ 14s] File "/usr/lib/python3.8/site-packages/chameleon/template.py", line 192, in render
[ 14s] self._render(stream, econtext, rcontext)
[ 14s] File "form_81055aeb629be740110c84995a4f16a5.py", line 522, in render
[ 14s] File "/usr/lib/python3.8/site-packages/chameleon/zpt/template.py", line 287, in translate
[ 14s] return txl(msgid, **kwargs)
[ 14s] File "/usr/lib/python3.8/site-packages/translationstring/__init__.py", line 229, in translate
[ 14s] result = translator(tstring)
[ 14s] File "/home/abuild/rpmbuild/BUILD/deform-2.0.14/deform/tests/test_renderer.py", line 20, in translator
[ 14s] return get_localizer(get_current_request()).translate(term)
[ 14s] File "/usr/lib/python3.8/site-packages/pyramid/i18n.py", line 228, in get_localizer
[ 14s] return request.localizer
[ 14s] AttributeError: 'NoneType' object has no attribute 'localizer'
[ 14s]
[ 14s] - Expression: "field.error"
[ 14s] - Filename: ... ld/rpmbuild/BUILD/deform-2.0.14/deform/templates/form.pt
[ 14s] - Location: (line 34: col 51)
[ 14s] - Source: ... lert-danger" tal:condition="field.error">
[ 14s] ^^^^^^^^^^^
[ 14s] - Arguments: cstruct: {...} (2)
[ 14s] field: <Form ('None',) at 0x7f59cd88dac0>
[ 14s] null: <_null ('None',) at 0x7f59ce34dd30>
[ 14s] target_language: <NoneType ('None',) at 0x7f59d4b46920>
[ 14s] repeat: <RepeatDict ('None',) at 0x7f59cd88d1c0>
[ 14s] style: <NoneType ('None',) at 0x7f59d4b46920>
[ 14s] css_class: deform
[ 14s] item_template: mapping_item
[ 14s] autocomplete: <NoneType ('None',) at 0x7f59d4b46920>
[ 14s] title:
[ 14s] errormsg: Username does not match password
[ 14s] description:
[ 14s] buttons: <list ('None',) at 0x7f59d0eb9680>
[ 14s] use_ajax: False
[ 14s] ajax_options: {}
[ 14s] formid: deform
[ 14s] action: <NoneType ('None',) at 0x7f59d4b46920>
[ 14s] method: POST
[ 14s]
[ 14s] ----------------------------------------------------------------------
[ 14s] Ran 399 tests in 0.707s
[ 14s]
[ 14s] FAILED (errors=1)
[ 14s] Test failed: <unittest.runner.TextTestResult run=399 errors=1 failures=0>
[ 14s] error: Test failed: <unittest.runner.TextTestResult run=399 errors=1 failures=0>
[ 14s] error: Bad exit status from /var/tmp/rpm-tmp.jHMR8X (%check)
[ 14s]
Obvioulsly, get_current_request()
returns None here, but for what reason? Sure , docs are pretty explicit about pyramid.threadlocal.get_current_request()
, but it doesn't discuss its instabilities.
This happens with variuos openSUSE builds available here.
All tests pass in Deform 2.0.14, per https://travis-ci.org/github/Pylons/deform/builds/726100865. I'm not sure what SUSE packaging does differently.
Cannot reproduce this issue anymore here as well - might be some transient toolchain/package version trouble here
Sorry for the churn, Steve!