plone / plone/plone.app.testing

customActions from plone.supermodel are being called before all config are done when using plone.app.testing

Open
#39 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2
Forks
7
Avg merge
1d 11h
Merged PRs (30d)
3

Description

This happened in collective.cover's PR after Plone 4.3.12 release.

Using Plone 4.3.11, collective.cover tests were working. They stopped working in 4.3.12. We detected (by doing a pdb in supermodel finalizeSchema) that the cause is cover's supermodel fields that aren't "loaded". supermodel needs to execute a customAction after all zcml are loaded. For some zcml dependency we didn't detected yet, in Plone 4.3.12, supermodel is loaded along packages that plone.app.testing loads. At that moment, cover's zcml isn't loaded yet so supermodel's customAction don't consider cover configurations, giving the error.

When bin/instance is called, xmlconfig.file is called only one time. When bin/test is called, xmlconfig.file is called for each package in products. So the customActions are executed multiple times in bin/test making customActions of supermodel being executed before collective.cover's configuration.

We don't know which package in https://github.com/plone/plone.app.testing/blob/62b236e7ede8a0b5a4b6c75f17379a2ac342bd49/plone/app/testing/layers.py#L38 caused the error.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the difference between bin/instance and bin/test, then read plone/app/testing/layers.py around the package-loading paths and zope.configuration's xmlconfig.file calls. Compare this with plone/supermodel/model.py and configure.zcml to identify the ordering dependency. Done means the collective.cover scenario no longer runs customActions before its configuration and has a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.