Open idgserpro opened 8 years ago
I may be totally wrong and I'm half asleep, but ... if I remember correctly the problem here is using the <includeDependencies package="." />
in your configure.zcml
.
So if you replace that line for a list of <include package="five.pt" />
then on your testing layers you only need to load your own ZCML and that's it.
To compile the list of packages to include on your configure.zcml you should look at which dependencies you have on your setup.py (and double check that all of them are still relevant and that you are not missing any - z3c.dependencychecker can help here).
I'm I right?
Correct.
@hvelarde This is somewhat related to your question in https://stackoverflow.com/q/35799092/644075: subtle differences between bin/instance
and bin/test
and what can we do to debug it.
@hvelarde and this issue https://github.com/collective/collective.cover/issues/586 as well.
@idgserpro I don't think so: I already removed <includeDependencies package="." />
in that package.
I'll take a look on collective.cover next week if you can't work on that today.
@hvelarde we still have differences when running bin/test
and bin/instance
, the meaning of this issue. If even removing includeDependencies
we still have problems, we need a way to compare both instances and see what is difference to know what it needs to be added (or removed) in our testing.py.
After all, I must or not use z3c.autoinclude?
@idgserpro z3c.autoinclude is a different beast and it saves you the need of adding your eggs
to zcml
also; that's why your packages will be discovered by Zope by using only:
[buildout]
...
eggs = my.package
instead of:
[buildout]
...
eggs = my.package
zcml = my.package
I think this is safe enough but @gotcha had a different view some time ago:
So, what you're saying is that it's safe to use z3c.autoinclude to avoid using the zcml part in our buildout, but we should avoid using <includeDependencies package="." />
in our configure.zcml? If so, we agree on that.
@pbauer we think this should be removed from bob templates. https://github.com/plone/bobtemplates.plone/blob/247585a1c777cc625e4e154cdffd2f7fe72862c7/bobtemplates/plone_addon/src/%2Bpackage.namespace%2B/%2Bpackage.name%2B/configure.zcml.bob#L12
Thoughts?
From plone.app.testing docs:
The problem with this approach is that we have a perfectly functional website, but when trying to test it, a bunch of the tests simply do not work because the instance from
bin/test
is different frombin/instance
.We've already tried to ask about more convention over configuration in the test framework to ease the pain of users in Plone, with the approach we think is the best cost benefit from an user perspective, without success, but we comprehend the performance problem and the conceptual definition that the test should be the minimal possible (we were trying a hybrid, pragmatic approach).
Fact is: we've been bitten by these differences in Plone itself and it's test layers and we don't know how to solve the problem: we don't know which packages should be explicity added since the dependency tree is really huge, so is pratically impossible to do it.
We know we should be creating packages that don't rely in z3c.autoinclude, but the real world isn't yet perfect specially when talking about third-party packages.
The question is: is there at least a way to compare what's been automatically included when running
bin/instance
andbin/test
? This can be a log, a snippet of code I need to run, a view, anything that can ease the pain when testing our infrastructure.Another question: is there anything I need to compare as well that isn't automatic loaded in plone.app.testing? We're not that confident anymore with our tests since they're not running on same code/runtime as prodution.
Somewhat related: https://community.plone.org/t/what-is-best-practice-for-meta-zcml-files-and-test-layers-in-plone-app-testing/442
@tomgross @mauritsvanrees @tisto @jensens @hannosch We're adding you to the discussion from previous conversations and knowledge we believe you have about this issue, feel free to remove yourselves if not related. Thanks for your time.