e3.testsuite.optfileparser

test.opt files processing.

This package provides a single class called OptFileParse which process the test.opt files. These files are used mainly to tweak tests depending on the context.

Attributes

OPTLINE_REGEXPS

TAGS

ARG

OVERIDABLE

logger

Exceptions

BadFormattingError

Raised when an input line is not correctly formatted.

Classes

OptFileParse

test.opt parser.

Functions

main(→ None)

Module Contents

e3.testsuite.optfileparser.OPTLINE_REGEXPS
exception e3.testsuite.optfileparser.BadFormattingError

Bases: Exception

Raised when an input line is not correctly formatted.

e3.testsuite.optfileparser.TAGS: Literal[0] = 0
e3.testsuite.optfileparser.ARG: Literal[1] = 1
e3.testsuite.optfileparser.OVERIDABLE: Literal[2] = 2
e3.testsuite.optfileparser.logger
class e3.testsuite.optfileparser.OptFileParse(system_tags: str | List[str], filename: str | List[str])

test.opt parser.

ATTRIBUTES

system_tags: the list of tags applied to the test.opt is_dead: True if the test should be considered DEAD, False otherwise

is_dead = False
__note: Tuple[List[str], str, bool] | None = None
__enable_note = False
__matches: Dict[str, Tuple[List[str], str, bool]]
get_value(cmd: str, default_value: str | None = None) str | None

Query on the parsing result.

Parameters:
  • cmd – The command on which we do the query ex: dead, cmd, out…

  • default_value – Value returned by default.

Returns:

A string or default value (None by default).

by default the query will return default_value if there is no entry for the selected command.

get_values(default_values: Dict[str, str | None]) Dict[str, str | None]

Query on the parsing result.

Parameters:

default_values – A dictionary for which keys are the commands on which we do the query and the associated default values.

Returns:

A dictionary containing the resulting value for each command.

Doing get_values({"CMD": "test.cmd", "OUT": "test.out"}) is equivalent to do:

get_value("CMD", "test.cmd")
get_value("OUT", "test.out")
get_note(sep: str | None = None) str | List[str]

Get the note.

Parameters:

sep – string used to join the activating tags. Default is “,”. If “” is specified then a list is returned.

Returns:

a string (list of tags responsible for the activation of the test) is sep is not “” or a list.

If there is no note then “” or [] is returned depending on the sep value

__process_opt_line(line: str) None

process one line of a test.opt type file.

Raises:

BadFormattingError – in case the line cannot be parsed

The format of each line is the following:

tag1,tag2,tag3,...,tagN [COMMAND [PARAMETERS]]

if no COMMAND is given then we assume that the command is ‘DEAD false’

__is_overidable(cmd: str) bool
classmethod __is_all(tag_list: List[str]) bool
__is_dead_cmd(cmd: str) bool
__match(tag_list: List[str]) bool

Match tags against the system tags.

True if all non-negated tags and none of the negated tags in the given list are present in system tags.

__parse_file(filename: str | List[str]) None
__str__() str
e3.testsuite.optfileparser.main(argv: List[str] | None = None) None