Gitlab: unable to run python27 tests

Hi, anyone is running successfully tests on gitlab CI with python27?
I'm trying everything but i always have an error when launching a bin script (instance or test).

You can see my configuration and experiments here: https://gitlab.com/cekk/example.package/-/jobs/
I started with bobtemplates.plone boilerplate.

Buildout compiles correctly, but test instance fails because it seems it doesn't find needed eggs.

The strange thing is that if i switch to python3.7 image, everything runs (the green test in the list).

I ran py2 on GitLab some time ago. Not open source though. By looking at the trace I can not see anything obvious. Are you creating your own virtualenv or using the GitLab/Docker Python?

The strange thing is that Plone cannot find itself:

File "/builds/cekk/example.package/eggs/Products.CMFPlone-5.2.1-py2.7.egg/Products/CMFPlone/__init__.py", line 8, in <module>

[1547](https://gitlab.com/cekk/example.package/-/jobs/484716902#L1547)  __version__ = pkg_resources.require("Products.CMFPlone")[0].version
   File "/builds/cekk/example.package/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 900, in require
     needed = self.resolve(parse_requirements(requirements))

I suspect that setuptools might be the guilty one.

Try to change:

virtualenv --clear -p python2.7 venv

to

virtualenv --clear -p python2.7 venv --no-site-packages --no-setuptools

@tisto i recall to made some tests some time ago but right now they seem to not work anymore. Probably something changed in python27 image or in setuptools?

@alert --no-site-packages is an unrecognized argument in that virtualenv version.

And yes, the strange thing is that Plone cannot find itself.

In a test with different image (python2.7-stretch) i had a different error:

 DistributionNotFound: The 'Zope2' distribution was not found and is required by the application

Did you try:

virtualenv --clear -p python2.7 venv --no-setuptools

We are doing some python2.7 testing in Gitlab-CI but it's not Plone specific. The .gitab-ci.yml file looks like this: https://pastebin.com/numgx5jY

I created a docker image for this: https://gitlab.com/it-spirit/plone-testing-base. Instead of the latest tag use python2. It is based on bobtemplates.plone's .gitlab-ci.yml and can be used with any Plone project. I use this as base for some customers now. The image is available on hub.docker.com. The readme shows an example usage.

Tried @tmassman image with python2 tag and conf in the readme, and i have the same exact result.

I've also tried with a less recent version of setuptools but i still have the same errors.

Which virtualenv version do you have. I am finding some broken builds with virtualenv 20 (released Feb this year)

Since this bit me today as well with Python 2.7, updating the local virtualenv to the latest version before the virtualenv is create is what helps:

before_script:
    # Git for 3rd party source packages
  - apt-get update && apt-get install -y --no-install-recommends git
  - git --version
  # Check Python version
  - python -V
  # Update Python virtual environment to latest version
  - pip install -U virtualenv
  - virtualenv --clear -p python2.7 venv
  - source venv/bin/activate
  - pip install -r requirements.txt
  - buildout -n -c buildout.cfg download-cache=downloads code-analysis:return-status-codes=True

I will update the docker image with a new built-in version soon.