Documentation issue - setting up a test environment for generated product addon

I'm following the steps on
https://docs.plone.org/develop/addons/index.html#create-a-package
to set up an environment to develop a content type product addon.

My basic setup is the latest stable Plone 5.0.7 setup by the unified installer. I choosed this setup, because i just want to set up a simple site with an own theme and one simple new content type - not much programming, not much Plone extending planned, just taking the latest stable and do some simple steps to extend it.

It looks to me that the documentation for extending Plone with own themes/products is focused around a special development environment i do not have with my setup. I did extend my buildout.cfg with the develop.cfg like so:

bin/buildout -c develop.cfg

This works, but when i want to run the pre-generated tests in the mr.bob created template product:

bin/test -s collective.shoparticle -t test_shoparticle.robot --all

i get the following error, test suite related:

Test-module import failures:

Module: collective.shoparticle.tests.test_robot

Traceback (most recent call last):
File "/usr/local/Plone5/zeocluster/src/collective.shoparticle/src/collective/shoparticle/tests/test_robot.py", line 2, in
from plone.app.testing import ROBOT_TEST_LEVEL
ImportError: No module named testing

Module: collective.shoparticle.tests.test_setup

Traceback (most recent call last):
File "/usr/local/Plone5/zeocluster/src/collective.shoparticle/src/collective/shoparticle/tests/test_setup.py", line 4, in
from collective.shoparticle.testing import COLLECTIVE_SHOPARTICLE_INTEGRATION_TESTING # noqa
File "/usr/local/Plone5/zeocluster/src/collective.shoparticle/src/collective/shoparticle/testing.py", line 2, in
from plone.app.contenttypes.testing import PLONE_APP_CONTENTTYPES_FIXTURE
File "/usr/local/Plone5/buildout-cache/eggs/plone.app.contenttypes-1.2.22-py2.7.egg/plone/app/contenttypes/testing.py", line 4, in
from plone.app.event.testing import PAEvent_FIXTURE
File "/usr/local/Plone5/buildout-cache/eggs/plone.app.event-2.0.12-py2.7.egg/plone/app/event/testing.py", line 3, in
from plone.app.robotframework.testing import AUTOLOGIN_LIBRARY_FIXTURE
ImportError: No module named robotframework.testing

Module: collective.shoparticle.tests.test_shoparticle

Traceback (most recent call last):
File "/usr/local/Plone5/zeocluster/src/collective.shoparticle/src/collective/shoparticle/tests/test_shoparticle.py", line 3, in
from plone.app.testing import setRoles
ImportError: No module named testing

Test-modules with import problems:
collective.shoparticle.tests.test_robot
collective.shoparticle.tests.test_setup
collective.shoparticle.tests.test_shoparticle
Total: 0 tests, 0 failures, 3 errors, 0 skipped in 0.000 seconds.

I'm willing to help to improve plone and its docs/addons, so please tell me what do you think of my approach: installing plone via the latest stable unified installer, and develop an addon-product on the filesystem, is this the right approach? Or should i better install everything with a special development buildout inside the generated packages ? So both ways are possible, but should both be documented ? Or should people like me be more directed into using a development install ?

I do not want to develop plone itself, i just want to set up a latest stable, develop a theme and a simple product. That "should" work in my eyes. So what do you think?

YMMV, but are you writing any acceptance tests using Robot Framework, of do you just need some basic unit/integration tests for your add-on? If the latter, you might just be able to run ./bin/test -s collective.shoparticle or something like that.

My read of your traceback is that the boilerplate has you using Robot tests, but docs presume you have the prerequisite dependencies for that in your build already (rather than explicitly spelling it out in the setup.py generated).

Sean

thank you for the quick response, Sean!

Even the provided buildout.cfg in the mrbob generated dexterity product addon does not run through cleanly, it gives:

...
Getting distribution for 'flake8-polyfill'.
warning: no files found matching 'CONTRIBUTORS.txt'
warning: no previously-included files matching '.pyc' found anywhere in distribution
warning: no files found matching '
.rst' under directory 'docs'
warning: no files found matching '.py' under directory 'docs'
warning: no files found matching '
.ini' under directory 'tests'
warning: no files found matching '.rst' under directory 'tests'
warning: no files found matching '
_diff' under directory 'tests'
no previously-included directories found matching 'docs/build/'
zip_safe flag not set; analyzing archive contents...
Got flake8-polyfill 1.0.1.
Getting distribution for 'configparser'.
Got configparser 3.5.0.
Getting distribution for 'enum34'.
zip_safe flag not set; analyzing archive contents...
Got enum34 1.1.6.
Getting distribution for 'mccabe<0.6.0,>=0.5.0'.
zip_safe flag not set; analyzing archive contents...

Installed /tmp/easy_install-4kU_Ld/mccabe-0.5.3/.eggs/pytest_runner-2.11.1-py2.7.egg
Got mccabe 0.5.3.
Version and requirements information containing pycodestyle:
Requirement of flake8-todo: pycodestyle<3.0.0,>=2.0.0
Requirement of flake8>=2.4.0: pycodestyle<2.1.0,>=2.0.0
While:
Installing.
Getting section code-analysis.
Initializing section code-analysis.
Installing recipe plone.recipe.codeanalysis[recommended].
Error: There is a version conflict.
We already have: pycodestyle 2.3.1
but flake8 3.0.4 requires 'pycodestyle<2.1.0,>=2.0.0'.

@seanupton
Ok, i have a clean testrun now on a bobtemplates generated dexterity product addon under unified installed plone 5.0.7 ! YES !!

[root@webserver zeocluster]# bin/test
Running tests at level 1
Running collective.shoparticle.testing.CollectiveShoparticleLayer:IntegrationTesting tests:
Set up plone.testing.zca.LayerCleanup in 0.001 seconds.
Set up plone.testing.z2.Startup in 0.279 seconds.
Set up plone.app.testing.layers.PloneFixtureCould not install product Products.CMFPlacefulWorkflow
in 17.937 seconds.
Set up plone.app.event.testing.PAEventLayer in 0.386 seconds.
Set up plone.app.contenttypes.testing.PloneAppContenttypes in 0.731 seconds.
Set up collective.shoparticle.testing.CollectiveShoparticleLayer in 1.866 seconds.
Set up collective.shoparticle.testing.CollectiveShoparticleLayer:IntegrationTesting in 0.000 seconds.
Running:
test_browserlayer (collective.shoparticle.tests.test_setup.TestSetup) (0.000 s)
test_product_installed (collective.shoparticle.tests.test_setup.TestSetup) (0.000 s)
test_browserlayer_removed (collective.shoparticle.tests.test_setup.TestUninstall) (0.269 s)
test_product_uninstalled (collective.shoparticle.tests.test_setup.TestUninstall) (0.168 s)
test_adding (collective.shoparticle.tests.test_shoparticle.ShopArticleIntegrationTest) (0.084 s)
test_factory (collective.shoparticle.tests.test_shoparticle.ShopArticleIntegrationTest) (0.003 s)
test_fti (collective.shoparticle.tests.test_shoparticle.ShopArticleIntegrationTest) (0.003 s)
test_schema (collective.shoparticle.tests.test_shoparticle.ShopArticleIntegrationTest) (0.003 s)
Ran 8 tests with 0 failures and 0 errors in 0.590 seconds.
Tearing down left over layers:
Tear down collective.shoparticle.testing.CollectiveShoparticleLayer:IntegrationTesting in 0.000 seconds.
Tear down collective.shoparticle.testing.CollectiveShoparticleLayer in 0.004 seconds.
Tear down plone.app.contenttypes.testing.PloneAppContenttypes in 0.149 seconds.
Tear down plone.app.event.testing.PAEventLayer in 0.007 seconds.
Tear down plone.app.testing.layers.PloneFixture in 0.074 seconds.
Tear down plone.testing.z2.Startup in 0.006 seconds.
Tear down plone.testing.zca.LayerCleanup in 0.001 seconds.
[root@webserver zeocluster]

Now my question: is it important to file a bug report/issue (for this configuration based on the current stable Plone5 version and its docs/bobtemplates), or better create a buildout from the current development tree and see if the error persists?

I have not enough experience with all this. But in my eyes a current stable should work as exepected, regarding the docs and generated bobtemplates code/tests.

1 Like

If you are getting an error with a mr.bob/bobtemplates.plone boilerplate with a released version of Plone, and the error is encountered as a result of instructions in the documentation, I think either of these is reasonable:

(1) Filing an issue in the documentation repository; make sure to describe how to duplicate the problem, which specific instruction step seems incorrect, and any workarounds (or deviations from what is documented).

-- or --

(2) Fork the documentation repository, and make some changes, then submit a pull request (and if necessary, contributor's agreement).

I do not get the sense that there is going to be a difference between what you would see between a 5.0.7, 5.1b3, or coredev build, as you describe this, but I could be wrong. In any case, the docs need to provide working instructions for the current version of Plone they are stated to be appropriate for.

Sean

1 Like

I created another bob templated basic content type, and nailed the problem down to a simple line in the setup.py which requires plone.testing 5.0.0.

The following is from the generated file:

extras_require={
    'test': [
        'plone.app.testing',
        # Plone KGS does not use this version, because it would break
        # Remove if your package shall be part of coredev.
        # plone_coredev tests as of 2016-04-01.
        'plone.testing>=5.0.0',
        'plone.app.contenttypes',
        'plone.app.robotframework[debug]',
    ],

changing this to

        'plone.testing>=4.1.1',

solves the problem, as this is the version of plone.testing pinned by the 5.0.7 plone buildout. So why the version in the bob template generated setup.py is to be 5.0.0 is a miracle to me - maybe i will understand this when i dig deeper into how mrbob and its templates work ...

A hint in how to find out from which plone version on plone.testing >= 5.0.0 is required would help, is there a way to grep through the whole changelog of the different plone versions?

EDIT: letting mr.bob generate files for the 5.0.6 version of Plone include the same setup.py

1 Like

@seanupton and @tdkuehnel, the version conflict error you got is because of a wrong pinning of bobtemplates.plone that created your package. See https://github.com/plone/bobtemplates.plone/issues/194, it's solved already but a new release of the package wasn't made.

Guys, we need a new release of bobtemplates.plone ASAP. @tisto or @pbauer, can you help us on this one since you're the maintainers in pypi? @gforcada already knows about this issue but don't have pypi rights (neither plone user). In the state we have bobtemplates.plone right now, a new user will have a broken package that can't even run buildout.

IMHO, I don't agree with any pins that bobtemplates.plone generate in the first place. The pin should be an extends pointing to the versions.cfg of the chosen Plone version when prompted (but this is another discussion in another thread).

1 Like