robot.running.resourcemodel
¶
ResourceFile
¶
Bases: ModelObject
Represents a resource file.
Source code in src/robot/running/resourcemodel.py
from_dict
classmethod
¶
Create this object based on data in a dictionary.
Data can be got from the :meth:to_dict
method or created externally.
With robot.running
model objects new in Robot Framework 6.1,
with robot.result
new in Robot Framework 7.0.
Source code in src/robot/model/modelobject.py
from_json
classmethod
¶
Create this object based on JSON data.
The data is given as the source
parameter. It can be:
- a string (or bytes) containing the data directly,
- an open file object where to read the data from, or
- a path (
pathlib.Path
or string) to a UTF-8 encoded file to read.
The JSON data is first converted to a Python dictionary and the object
created using the :meth:from_dict
method.
Notice that the source
is considered to be JSON data if it is
a string and contains {
. If you need to use {
in a file system
path, pass it in as a pathlib.Path
instance.
With robot.running
model objects new in Robot Framework 6.1,
with robot.result
new in Robot Framework 7.0.
Source code in src/robot/model/modelobject.py
to_json
¶
Serialize this object into JSON.
The object is first converted to a Python dictionary using the
:meth:to_dict
method and then the dictionary is converted to JSON.
The file
parameter controls what to do with the resulting JSON data.
It can be:
None
(default) to return the data as a string,- an open file object where to write the data to, or
- a path (
pathlib.Path
or string) to a file where to write the data using UTF-8 encoding.
JSON formatting can be configured using optional parameters that
are passed directly to the underlying json__ module. Notice that
the defaults differ from what json
uses.
With robot.running
model objects new in Robot Framework 6.1,
with robot.result
new in Robot Framework 7.0.
__ https://docs.python.org/3/library/json.html
Source code in src/robot/model/modelobject.py
config
¶
Configure model object with given attributes.
obj.config(name='Example', doc='Something')
is equivalent to setting
obj.name = 'Example'
and obj.doc = 'Something'
.
New in Robot Framework 4.0.
Source code in src/robot/model/modelobject.py
copy
¶
Return a shallow copy of this object.
:param attributes: Attributes to be set to the returned copy.
For example, obj.copy(name='New name')
.
See also :meth:deepcopy
. The difference between copy
and
deepcopy
is the same as with the methods having same names in
the copy__ module.
__ https://docs.python.org/3/library/copy.html
Source code in src/robot/model/modelobject.py
deepcopy
¶
Return a deep copy of this object.
:param attributes: Attributes to be set to the returned copy.
For example, obj.deepcopy(name='New name')
.
See also :meth:copy
. The difference between deepcopy
and
copy
is the same as with the methods having same names in
the copy__ module.
__ https://docs.python.org/3/library/copy.html
Source code in src/robot/model/modelobject.py
name
property
¶
Resource file name.
None
if resource file is part of a suite or if it does not have
:attr:source
, name of the source file without the extension otherwise.
from_file_system
classmethod
¶
Create a :class:ResourceFile
object based on the give path
.
:param path: File path where to read the data from.
:param config: Configuration parameters for :class:~.builders.ResourceFileBuilder
class that is used internally for building the suite.
New in Robot Framework 6.1. See also :meth:from_string
and :meth:from_model
.
Source code in src/robot/running/resourcemodel.py
from_string
classmethod
¶
|
Create a :class:ResourceFile
object based on the given string
.
:param string: String to create the resource file from.
:param config: Configuration parameters for
:func:~robot.parsing.parser.parser.get_resource_model
used internally.
New in Robot Framework 6.1. See also :meth:from_file_system
and
:meth:from_model
.
Source code in src/robot/running/resourcemodel.py
from_model
classmethod
¶
|
Create a :class:ResourceFile
object based on the given model
.
:param model: Model to create the suite from.
The model can be created by using the
:func:~robot.parsing.parser.parser.get_resource_model
function and possibly
modified by other tooling in the :mod:robot.parsing
module.
New in Robot Framework 6.1. See also :meth:from_file_system
and
:meth:from_string
.
Source code in src/robot/running/resourcemodel.py
UserKeyword
¶
Bases: KeywordImplementation
Represents a user keyword.
Source code in src/robot/running/resourcemodel.py
from_dict
classmethod
¶
Create this object based on data in a dictionary.
Data can be got from the :meth:to_dict
method or created externally.
With robot.running
model objects new in Robot Framework 6.1,
with robot.result
new in Robot Framework 7.0.
Source code in src/robot/model/modelobject.py
from_json
classmethod
¶
Create this object based on JSON data.
The data is given as the source
parameter. It can be:
- a string (or bytes) containing the data directly,
- an open file object where to read the data from, or
- a path (
pathlib.Path
or string) to a UTF-8 encoded file to read.
The JSON data is first converted to a Python dictionary and the object
created using the :meth:from_dict
method.
Notice that the source
is considered to be JSON data if it is
a string and contains {
. If you need to use {
in a file system
path, pass it in as a pathlib.Path
instance.
With robot.running
model objects new in Robot Framework 6.1,
with robot.result
new in Robot Framework 7.0.
Source code in src/robot/model/modelobject.py
to_json
¶
Serialize this object into JSON.
The object is first converted to a Python dictionary using the
:meth:to_dict
method and then the dictionary is converted to JSON.
The file
parameter controls what to do with the resulting JSON data.
It can be:
None
(default) to return the data as a string,- an open file object where to write the data to, or
- a path (
pathlib.Path
or string) to a file where to write the data using UTF-8 encoding.
JSON formatting can be configured using optional parameters that
are passed directly to the underlying json__ module. Notice that
the defaults differ from what json
uses.
With robot.running
model objects new in Robot Framework 6.1,
with robot.result
new in Robot Framework 7.0.
__ https://docs.python.org/3/library/json.html
Source code in src/robot/model/modelobject.py
config
¶
Configure model object with given attributes.
obj.config(name='Example', doc='Something')
is equivalent to setting
obj.name = 'Example'
and obj.doc = 'Something'
.
New in Robot Framework 4.0.
Source code in src/robot/model/modelobject.py
copy
¶
Return a shallow copy of this object.
:param attributes: Attributes to be set to the returned copy.
For example, obj.copy(name='New name')
.
See also :meth:deepcopy
. The difference between copy
and
deepcopy
is the same as with the methods having same names in
the copy__ module.
__ https://docs.python.org/3/library/copy.html
Source code in src/robot/model/modelobject.py
deepcopy
¶
Return a deep copy of this object.
:param attributes: Attributes to be set to the returned copy.
For example, obj.deepcopy(name='New name')
.
See also :meth:copy
. The difference between deepcopy
and
copy
is the same as with the methods having same names in
the copy__ module.
__ https://docs.python.org/3/library/copy.html
Source code in src/robot/model/modelobject.py
matches
¶
Returns true if name
matches the keyword name.
With normal keywords matching is a case, space and underscore insensitive string comparison. With keywords accepting embedded arguments, matching is done against the name.
Source code in src/robot/running/keywordimplementation.py
setup
property
writable
¶
User keyword setup as a :class:Keyword
object.
New in Robot Framework 7.0.
has_setup
property
¶
Check does a keyword have a setup without creating a setup object.
See :attr:has_teardown
for more information. New in Robot Framework 7.0.
has_teardown
property
¶
Check does a keyword have a teardown without creating a teardown object.
A difference between using if kw.has_teardown:
and if kw.teardown:
is that accessing the :attr:teardown
attribute creates a :class:Keyword
object representing the teardown even when the user keyword actually does
not have one. This can have an effect on memory usage.
New in Robot Framework 6.1.
Import
¶
Bases: ModelObject
Represents library, resource file or variable file import.
Source code in src/robot/running/resourcemodel.py
from_json
classmethod
¶
Create this object based on JSON data.
The data is given as the source
parameter. It can be:
- a string (or bytes) containing the data directly,
- an open file object where to read the data from, or
- a path (
pathlib.Path
or string) to a UTF-8 encoded file to read.
The JSON data is first converted to a Python dictionary and the object
created using the :meth:from_dict
method.
Notice that the source
is considered to be JSON data if it is
a string and contains {
. If you need to use {
in a file system
path, pass it in as a pathlib.Path
instance.
With robot.running
model objects new in Robot Framework 6.1,
with robot.result
new in Robot Framework 7.0.
Source code in src/robot/model/modelobject.py
to_json
¶
Serialize this object into JSON.
The object is first converted to a Python dictionary using the
:meth:to_dict
method and then the dictionary is converted to JSON.
The file
parameter controls what to do with the resulting JSON data.
It can be:
None
(default) to return the data as a string,- an open file object where to write the data to, or
- a path (
pathlib.Path
or string) to a file where to write the data using UTF-8 encoding.
JSON formatting can be configured using optional parameters that
are passed directly to the underlying json__ module. Notice that
the defaults differ from what json
uses.
With robot.running
model objects new in Robot Framework 6.1,
with robot.result
new in Robot Framework 7.0.
__ https://docs.python.org/3/library/json.html
Source code in src/robot/model/modelobject.py
config
¶
Configure model object with given attributes.
obj.config(name='Example', doc='Something')
is equivalent to setting
obj.name = 'Example'
and obj.doc = 'Something'
.
New in Robot Framework 4.0.
Source code in src/robot/model/modelobject.py
copy
¶
Return a shallow copy of this object.
:param attributes: Attributes to be set to the returned copy.
For example, obj.copy(name='New name')
.
See also :meth:deepcopy
. The difference between copy
and
deepcopy
is the same as with the methods having same names in
the copy__ module.
__ https://docs.python.org/3/library/copy.html
Source code in src/robot/model/modelobject.py
deepcopy
¶
Return a deep copy of this object.
:param attributes: Attributes to be set to the returned copy.
For example, obj.deepcopy(name='New name')
.
See also :meth:copy
. The difference between deepcopy
and
copy
is the same as with the methods having same names in
the copy__ module.
__ https://docs.python.org/3/library/copy.html
Source code in src/robot/model/modelobject.py
Imports
¶
Bases: ItemList
Source code in src/robot/running/resourcemodel.py
to_dicts
¶
Return list of items converted to dictionaries.
Items are converted to dictionaries using the to_dict
method, if
they have it, or the built-in vars()
.
New in Robot Framework 6.1.
Source code in src/robot/model/itemlist.py
resource
¶
variables
¶
create
¶
Generic method for creating imports.
Import type specific methods :meth:library
, :meth:resource
and
:meth:variables
are recommended over this method.