collective / collective.easyform

Forms for Plone
https://pypi.org/project/collective.easyform
13 stars 29 forks source link

The tests on master are broken #434

Closed ale-rt closed 1 month ago

ale-rt commented 1 month ago

The test that breaks on GHA is:

Failure in test test_validator_translation (collective.easyform.tests.testValidators.TestBaseValidators.test_validator_translation)
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/unittest/case.py", line 57, in testPartExecutor
    yield
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/unittest/case.py", line 623, in run
    self._callTestMethod(testMethod)
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/unittest/case.py", line 579, in _callTestMethod
    if method() is not None:
  File "/home/runner/work/collective.easyform/collective.easyform/src/collective/easyform/tests/testValidators.py", line 177, in test_validator_translation
    self.assertEqual(errors[0].createMessage(), expected_error_message)
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/unittest/case.py", line 873, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/unittest/case.py", line 1253, in assertMultiLineEqual
    self.fail(self._formatMessage(msg, standardMsg))
  File "/opt/hostedtoolcache/Python/3.11.10/x64/lib/python3.11/unittest/case.py", line 703, in fail
    raise self.failureException(msg)
AssertionError: "Validation failed(isInternationalPhoneNumber):[54 chars]ber." != "Validierung fehlgeschlagen (isInternationalPho[68 chars]mmer"
- Validation failed(isInternationalPhoneNumber): 'testcomments' is not a valid international phone number.
+ Validierung fehlgeschlagen (isInternationalPhoneNumber): 'testcomments' Ist keine gültige internationale Telefonnummer

Locally the test works.

Apparently it is related to something that changed between Plone 6.0.12 and 6.0.13 because this patch:

diff --git a/tests-6.0.x.cfg b/tests-6.0.x.cfg
index 3d9a627..0c0a902 100644
--- a/tests-6.0.x.cfg
+++ b/tests-6.0.x.cfg
@@ -2,3 +2,4 @@
 extends =
     https://raw.githubusercontent.com/collective/buildout.plonetest/master/test-6.0.x.cfg
     base.cfg
+    https://dist.plone.org/release/6.0.12/versions.cfg

fixes the GHA.

ale-rt commented 1 month ago

In Plone 6.0.13 some translations were moved to Products.validation. In order to load them, the zcml that loads the translation catalog should be loaded.

435 does that and fixes this issue.