Error with HTML exporter when running Checkbox in a virtual environment

Bug #1980777 reported by Pierre Equoy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Next Generation Checkbox (CLI)
Expired
Undecided
Unassigned

Bug Description

Steps
=====

Install Checkbox using the mk-venv script:

git clone git+ssh://<email address hidden>/checkbox-ng
cd checkbox-ng
./mk-venv

Activate the venv and start checkbox:

source path/to/venv/bin/activate
(venv) $ checkbox-cli

Expected result
===============

Checkbox can run and export HTML report using the default Jinja2 exporter.

Actual result
=============

An error is displayed before the Test Plan selection screen:

-------------------------------------
ERROR:plainbox.session.assistant:Problems encountered when loading com.canonical.plainbox:exporters provider: [PlugInError("Problem in unit definition, \x1b[31m\x1b[1merror\x1b[0m: /home/pierre/dev/checkbox-project/checkbox-ng/plainbox/impl/providers/exporters/units/exporter.pxu:4: exporter 'html', field 'entry_point', cannot import name 'environmentfilter' from 'jinja2' (/home/pierre/dev/checkbox-project/checkbox-ng/venv/lib/python3.8/site-packages/Jinja2-3.1.2-py3.8.egg/jinja2/__init__.py)")]
-------------------------------------

When a test run completes, the HTML report cannot be generated:

-------------------------------------
ERROR:checkbox-ng.launcher.stages:Problem with a '1_text_to_screen' report using 'com.canonical.plainbox::text' exporter sent to 'python://stdout' transport.
ERROR:checkbox-ng.launcher.stages:Problem with a '2_html_file' report using 'com.canonical.plainbox::html' exporter sent to '/home/pierre/.local/share/checkbox-ng/submission_2022-07-05T13.14.15.824544.html' transport.
ERROR:checkbox-ng.launcher.stages:Problem with a '2_junit_file' report using 'com.canonical.plainbox::junit' exporter sent to '/home/pierre/.local/share/checkbox-ng/submission_2022-07-05T13.14.15.824544.junit.xml' transport.
ERROR:checkbox-ng.launcher.stages:Problem with a '2_tar_file' report using 'com.canonical.plainbox::tar' exporter sent to '/home/pierre/.local/share/checkbox-ng/submission_2022-07-05T13.14.15.824544.tar.xz' transport.
-------------------------------------

Investigation
=============

When running mk-venv, the latest versions of each required Python packages is installed. At time of writing, it means Jinja2 v3.1.2. However, in v3.1.0[1], Markup and escape were deprecated and moved to another Python package (markupsafe). See jinja2 src[2] for more info.

For now, Ubuntu repos are still using older versions of Jinja2[3].

Workaround
==========

Install Jinja2 and MarkupSafe with versions similar to the ones in the repos of a given Ubuntu version. For instance, to match the versions found in Ubuntu 20.04:

(venv) $ pip install jinja2==2.10.1
(venv) $ pip install markupsafe==1.1.0

[1] https://jinja.palletsprojects.com/en/3.1.x/changes/?highlight=markup#version-3-1-0
[2] https://github.com/pallets/jinja/pull/1544/files#diff-99868302c0e75a5c181912aab0e396266e2ce25fd7b0b8f29684df74eef49984L836
[3] https://packages.ubuntu.com/search?keywords=python3-jinja2&searchon=names&suite=all&section=all

Revision history for this message
Maksim Beliaev (beliaev-maksim) wrote :

Bug was migrated to GitHub: https://github.com/canonical/checkbox/issues/238.
Bug is no more monitored here.

Changed in checkbox-ng:
status: New → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.