How to test a Plone add-on easily

published Jan 12, 2022

A quick primer into how to get the testing environment of most common Plone add-ons going.

How to test a Plone add-on easily

This example is based on collective.exportimport.  It assumes you are running on a recent Fedora release, that you have a terminal window open, and you have the source code of the add-on you're testing.

sudo dnf install -y /usr/bin/toolbox
cd /your/source/code
toolbox create -r 34
toolbox enter -r 34

# From here on, you are running on a Fedora 34 container, which
# happens to also have your source code in the current directory.
# Nothing you touch outside your home directory is going to
# affect your operating system.

# This command installs (to your container) the minimum to compile
# Python and Zope dependencies.
sudo dnf install -y libpng-devel libjpeg-turbo-devel make gcc

# Put pyenv to work in your terminal session's environment.
export PATH=~/.pyenv/bin:$PATH
eval "$(pyenv virtualenv-init -)"

# Install Python (in this example 2.7.18) to a new env.
pyenv virtualenv 2.7.18 nameofyourenv-py2
pyenv local nameofyourenv-py2

# Install and buildout.
pip install -r requirements.txt
buildout

That is all you need to get started.