PyTest Markers related utilities#

PyTest Markers related utilities.

pytestskipmarkers.utils.markers.skip_if_not_root()[source]#

Helper function to check for root/Administrator privileges.

Returns:

str: The reason of the skip

Return type

Optional[str]

pytestskipmarkers.utils.markers.skip_if_binaries_missing(binaries, check_all=True, reason=None)[source]#

Helper function to check for existing binaries.

Args:
binaries (list or tuple):

Iterator of binaries to check

check_all (bool):

If check_all is True, the default, all binaries must exist. If check_all is False, then only one the passed binaries needs to be found. Useful when, for example, passing a list of python interpreter names(python3.5, python3, python), where only one needs to exist.

reason (str):

The skip reason.

Returns:

str: The reason for the skip. None: Should not be skipped.

Parameters
Return type

Optional[str]

pytestskipmarkers.utils.markers.skip_if_no_local_network()[source]#

Helper function to check for existing local network.

Returns:

str: The reason for the skip. None: Should not be skipped.

Return type

Optional[str]

pytestskipmarkers.utils.markers.skip_if_no_remote_network()[source]#

Helper function to check for existing remote network(internet).

Returns:

str: The reason for the skip. None: Should not be skipped.

Return type

Optional[str]

pytestskipmarkers.utils.markers.skip_on_env(varname, present=True, eq=None, ne=None, reason=None)[source]#

Helper function to check for environment variables.

If any of the checks match, return the skip reason.

Args:
varname(str):

The environment variable to check

present(bool):

When True, skip if variable is present in the environment. When False, skip if variable is not present in the environment.

eq(str):

Skips when the variable is present in the environment and matches this value.

ne(str):

Skips when the variable is present in the environment and does not match this value.

reason(str):

The custom reason message to use.

Returns:

str: The skip reason None: Should not be skipped.

Parameters
Return type

Optional[str]

pytestskipmarkers.utils.markers.evaluate_markers(item)[source]#

Fixtures injection based on markers or test skips based on CLI arguments.

Parameters

item (Item) –

Return type

None