I have created a custom library in Python that one of the functions in the __init__
module is self.create_new_folder()
.
Robot Framework initializes the library twice:
Once in the suite setup (I do not initialize the library myself, robot does it automatically).
The second time it initializes the library is when it calls the first custom keyword from the custom library, and the test fails because the folder is already created.
I can check if the folder already exists but I would like to know if there is a way to force Robot to initialize the library only once.
If you set
ROBOT_LIBRARY_SCOPE
toGLOBAL
, the library will be instantiated exactly once for a test run.From the documentation:
Example:
See http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#test-library-scope