The Avocado team is proud to present another release: Avocado version 52.0, the second Avocado LTS version.
When compared to the last LTS (v36), the main changes introduced by this versions are:
- Support for TAP version 12 results, which are generated by default
in test results directory (
- The download of assets in tests now allow for an expiration time.
- Environment variables can be propagated into tests running on remote systems.
- The plugin interfaces have been moved into the
- Support for running tests in a Docker container.
- Introduction of the “Fail Fast” feature (
--failfast onoption) to the
runcommand, which interrupts the Job on a first test failure.
- Special keyword
latestfor replaying previous jobs.
- Support to replay a Job by path (in addition to the Job ID method and
- Diff-like categorized report of jobs
avocado diff <JOB_1> <JOB_2>).
- The introduction of a
- The automatic VM IP detection that kicks in when one uses
--vm-domainwithout a matching
--vm-hostname, now uses a more reliable method (libvirt/qemu-gust-agent query).
LC_ALL=Cby default on sysinfo collection to simplify avocado diff comparison between different machines.
- Result plugins system is now pluggable and the results plugins (JSON,
XUnit, HTML) were turned into stevedore plugins. They are now listed
- Multiplexer was replaced with Varianter plugging system with defined API to register plugins that generate test variants.
--multiplexargument, which used to turn yaml files into variants, is now handled by an optional plugin called
--multiplexoption is being deprecated in favour of the
--mux-yamloption, which behaves the same way.
- It’s now possible to disable plugins by using the configuration file.
- Better error handling of the virtual machine plugin (
--vm-domainand related options).
- When discovering tests on a directory, the result now is a properly alphabetically ordered list of tests.
- Plugins can now be setup in Avocado configuration file to run at a specific order.
- Support for filtering tests by user supplied “tags”.
- Users can now see the test tags when listing tests with the
- Users can now choose to keep the complete set of files, including
temporary ones, created during an Avocado job run by using the
--keep-tmpoption (e.g. to keep those files for
- Tests running with the external runner (
--external-runner) feature will now have access to the extended behavior for SIMPLE tests, such as being able to exit a test with the WARNING status.
- Encoding support was improved and now Avocado should safely treat localized test-names.
- Test writers now have access to a test temporary directory that will
last not only for the duration of the test, but for the duration of
the whole job execution to allow sharing state/exchanging data between
tests. The path for that directory is available via Test API
self.teststmpdir) and via environment variable (
- Avocado is now available on Fedora standard repository. The package
python2-avocado. The optional plugins and examples packages are also available. Run
dnf search avocadoto list them all.
- Optional plugins and examples packages are also available on PyPI
- Avocado test writers can now use a family of decorators, namely
avocado.skipUnless()to skip the execution of tests.
- Sysinfo collection based on command execution now allows a timeout to be set in the Avocado configuration file.
- The non-local runner plugins, the html plugin and the yaml_to_mux plugin are now distributed in separate packages.
- The Avocado main process will now try to kill all test processes before terminating itself when it receives a SIGTERM.
- Support for new type of test status,
CANCEL, and of course the mechanisms to set a test with this status (e.g. via
avocado.TestCancelare now public Avocado Test APIs, available in the main avocado namespace.
- Introduction of the robot plugin, which allows Robot Framework tests to be listed and executed natively within Avocado.
- A brand new ResultsDB optional plugin.
- Listing of supported loaders (
--loaders \?) was refined.
- Variant-IDs generated by yaml_to_mux plugin now include leaf node names to make them more meaningful, making easier to skim through the results.
- yaml_to_mux now supports internal filters defined inside the YAML file expanding the filtering capabilities even further.
- Avocado now supports resuming jobs that were interrupted.
- The HTML report now presents the test ID and variant ID in separate columns, allowing users to also sort and filter results based on those specific fields.
- The HTML report will now show the test parameters used in a test when the user hovers the cursor over the test name.
- Avocado now reports the total job execution time on the UI, instead of just the tests execution time.
avocado variantshas been added which supersedes the
- Loaders were tweaked to provide more info on
avocado list -Vespecially when they don’t recognize the reference.
- Users can use
--ignore-missing-references onto run a job with undiscovered test references
- Users can now choose in which order the job will execute tests (from
its suite) and variants. The two available options are
- Test methods can be recursively discovered from parent classes by upon
:avocado: recursivedocstring directive.
Besides the list above, we had several improvements in our
libraries that are important for test writers, some of them are listed
compare_matriceswere added in
avocado.utilsnew modules were introduced, like
avocado.utils.memorycontains several new methods.
avocado.utils.processlibrary makes it possible to ignore spawned background processes.
- Users of the
avocado.utils.processmodule will now be able to access the process ID in the
avocado.utils.iso9660with a more complete standard API across all back-end implementations.
avocado.utils.build.make(), which will now return the make process exit status code.
avocado.Testclass now better exports (and protects) the core class attributes members (such as
avocado.utils.linux_modulesfunctions now returns module name, size, submodules if present, filename, version, number of modules using it, list of modules it is dependent on and finally a list of
It is also worth mentioning:
- Improved documentation, with new sections to Release Notes and Optional Plugins, very improved Contribution and Community Guide. New content and new examples everywhere.
- The avocado-framework-tests GitHub organization was founded to encourage companies to share Avocado tests.
- Bugs were always handled as high priority and every single version was delivered with all the reported bugs properly fixed.
When compared to the last LTS, we had:
- 1187 commits (and counting).
- 15 new versions.
- 4811 more lines of Python code (+27,42%).
- 1800 more lines of code comment (+24,67%).
- 31 more Python files (+16,48%).
- 69 closed GitHub issues.
- 34 contributors from at least 12 different companies, 26 of them contributing for the fist time to the project.
Switching from 36.4 to 52.0¶
You already know what new features you might expect, but let’s emphasize the main changes required to your workflows/tests when switching from 36.4 to 52.0
All the previously supported ways to install Avocado are still valid and few new ones were added, but beware that Avocado was split into several optional plugins so you might want to adjust your scripts/workflows.
- Multiplexer (the YAML parser which used to generate variants) was
turned into an optional plugin
yaml_to_muxalso known as
avocado_framework_plugin_varianter_yaml_to_mux. Without it Avocado does not require PyYAML, but you need it to support the parsing of YAML files to variants (unless you use a different plugin with similar functionality, which is now also possible).
- The HTML result plugin is now also an optional plugin so one has to install it separately.
- The remote execution features (
--docker) were also turned into optional plugins so if you need those you need to install them separately.
- Support for virtual environment (
venv) was greatly improved and we do encourage people who want to use
pipto do that via this method.
As for the available ways:
- Fedora/RHEL can use our custom repositories, either LTS-only or all releases. Note that latest versions (non-lts) are also available directly in Fedora and also in EPEL.
- OpenSUSE - Ships the 36 LTS versions, hopefully they’ll start shipping the 52 ones as well (but we are not in charge of that process)
- Debian - The
contrib/packages/debianscript is still available, although un-maintained for a long time
- PyPI/pip - Avocado as well as all optional plugins are available in
PyPI and can be installed via
pip install avocado-framework\*, or selectively one by one.
- From source - Makefile target
installis still available but it does not install the optional plugins. You have to install them one by one by going to their directory (eg.
cd optional_plugins/htmland running
sudo python setup.py install)
As before you can find the details in Installing Avocado.
As mentioned in previous section some previously core features were turned into optional plugins. Do check your install script if some command described here are missing on your system.
Most workflows should work the same, although there are few little changes and a few obsoleted constructs which are still valid, but you should start using the new ones.
The hard changes which does not provide backward compatibility:
- Human result was tweaked a bit:
TESTSentry (displaying number of tests) was removed as one can easily get this information from
- Instead of tests time (sum of test times) you get job time (duration of the job execution) in the human result
- Json results also contain some changes:
- They are pretty-printed
cancelstatus was introduced, json result contain an entry of number of canceled tests (
- url was renamed to id (url entry is to be removed in
53.0so this is actually a soft change with a backward compatibility support)
avocado multilex|variantsdoes not expect multiplex YAML files as positional arguments, one has to use
-m|--mux-yamlfollowed by one or more paths.
- Test variants are not serialized numbers anymore in the default
multiplexer), but ordered list of leaf-node names of the variant followed by hash of the variant content (paths+environment). Therefor instead of
my_test:1you can get something like
results.tapis now generated by default in job results along the
avocado run --replayand
avocado diffare unable to parse results generated by
36.4to this date. We should be able to introduce such feature with not insignificant effort, but no one was interested yet.
And the still working but to be removed in
The long version of the
-m|--multiplexargument available in
avocado run|multiplex|variantswas renamed to
-m|--mux-yamlwhich corresponds better to the rest of
avocado multiplexwas renamed to
avocado multiplex|variantsarguments were reworked to better suite the possible multiple varianter plugins:
- Instead of picking between
treerepresentation of list of variants one can use
--variantsfollowed by verbosity, which supersedes
- Instead of
--mux-pathis now also available in
- Instead of picking between
Main features stayed the same, there are few new ones so do check our documentation for details. Anyway while porting tests you should pay attention to following changes:
- If you were overriding
runner_queue, ...) you’ll get an
AttributeError: can't set attributeerror as most of them were turned into properties to avoid accidental override of the important attributes.
tearDownmethod is now executed almost always (always when the
setUpis entered), including when the test is interrupted while running
setUp. This might require some changes to your
tearDownmethods but generally it should make them simpler. (See Setup and cleanup methods and following chapters for details)
- Test exceptions are publicly available directly in
TestCancel) and when raised inside test they behave the same way as
- New status is available called
CANCEL. It means the test (or even just
setUp) started but the test does not match prerequisites. It’s similar to
SKIPin other frameworks, but the
SKIPresult is reserved for tests that were not executed (nor the
setUpwas entered). The
CANCELstatus can be signaled by
self.cancelor by raising
avocado.TestCancelexception and the
SKIPshould be set only by
self.skipmethod is still supported but will be removed after in
53.0so you should replace it by
self.cancelwhich has similar meaning but it additionally executes the
tearDown. (See Test statuses
avocado.Testwas removed as it is part of
name, which can only be
self.job.logdirwhich used to be abused to share state/data between tests inside one job can now be dropped towards the
self.teststmpdir, which is a shared temporary directory which sustains throughout job execution and even between job executions if set via
AVOCADO_TESTS_COMMON_TMPDIRenvironmental value. (See
- Those who write inherited test classes will be pleasantly surprised as
it is now possible to mark a class as avocado test including all
test*methods coming from all parent classes (similarly to how dynamic discovery works inside python unittest, see Recursively Discovering Tests for details)
self.text_outputis not published after the test execution. If you were using it simply open the
self.logfileand read the content yourself.
Focusing only on the changes you might need to adjust the usage of:
avocado.utils.build.makecalls as it now reports only
exit_status. To get the full result object you need to execute
Red Hat Enterprise Linux/
avocado.processwhere the check for availability of
sudowas improved, which might actually start executing some code which used to fail in 36.4.
Also check out the
avocado.utils for complete list of available
utils as there were many additions between 36.4 and 52.0.