cfme.utils.version module

cfme.utils.version.SPTuple

alias of StreamProductTuple

class cfme.utils.version.Version(vstring)[source]

Bases: object

Version class based on distutil.version.LooseVersion

SUFFIXES = ('nightly', 'pre', 'alpha', 'beta', 'rc')
SUFFIXES_STR = '-nightly(?:\\d+(?:\\.\\d+)?)?|-pre(?:\\d+(?:\\.\\d+)?)?|-alpha(?:\\d+(?:\\.\\d+)?)?|-beta(?:\\d+(?:\\.\\d+)?)?|-rc(?:\\d+(?:\\.\\d+)?)?'
__contains__(ver)[source]

Enables to use in expression for Version.is_in_series().

Example

"5.5.5.2" in Version("5.5") returns ``True

Parameters:ver – Version that should be checked if it is in series of this version. If str provided, it will be converted to Version.
component_re = <_sre.SRE_Pattern object at 0x4d07bb0>
is_in_series(series)[source]

This method checks whether the version belongs to another version’s series.

Eg.: Version("5.5.5.2").is_in_series("5.5") returns True

Parameters:series – Another Version to check against. If string provided, will be converted to Version
classmethod latest()[source]
classmethod lowest()[source]
normalized_suffix

Turns the string suffixes to numbers. Creates a list of tuples.

The list of tuples is consisting of 2-tuples, the first value says the position of the suffix in the list and the second number the numeric value of an eventual numeric suffix.

If the numeric suffix is not present in a field, then the value is 0

parse(vstring)[source]
product_version()[source]
series(n=2)[source]
stream()[source]
suffix_item_re = <_sre.SRE_Pattern object>
cfme.utils.version.appliance_build_date()[source]
cfme.utils.version.appliance_build_datetime()[source]
cfme.utils.version.appliance_has_netapp()[source]
cfme.utils.version.appliance_is_downstream()[source]
cfme.utils.version.before_date_or_version(date=None, version=None)[source]

Function for deciding based on the build date and version.

Usage:

* If both date and version are set, then two things can happen. If the appliance is
    downstream, both date and version are checked, otherwise only the date.
* If only date is set, then only date is checked.
* if only version is set, then it checks the version if the appliance is downstream,
    otherwise it returns ``False``

The checks are in form appliance_build_date() < date and current_version() < version. Therefore when used in if statement, the truthy value signalizes ‘older’ version and falsy signalizes ‘newer’ version.

cfme.utils.version.current_stream()[source]
cfme.utils.version.current_version()[source]

A lazy cached method to return the appliance version.

Do not catch errors, since generally we cannot proceed with testing, without knowing the server version.

cfme.utils.version.dependent(default_function)[source]
cfme.utils.version.get_product_version(ver)[source]

Return product version for given Version obj or version string

cfme.utils.version.get_stream(ver)[source]

Return a stream name for given Version obj or version string

cfme.utils.version.get_version(obj=None)[source]

Return a Version based on obj. For CFME, ‘master’ version means always the latest (compares as greater than any other version)

If obj is None, the version will be retrieved from the current appliance

cfme.utils.version.parsedate(o)[source]
cfme.utils.version.pick(v_dict)[source]

Collapses an ambiguous series of objects bound to specific versions by interrogating the CFME Version and returning the correct item.

cfme.utils.version.product_version_dispatch(*_args, **_kwargs)[source]

Dispatch function for use in multimethods that just ignores arguments and dispatches on the current product version.

cfme.utils.version.since_date_or_version(*args, **kwargs)[source]

Opposite of before_date_or_version()