I am writing a custom testing library for Robot Framework
in Python
and I want to import it like this:
Library CustomLibrary
I put the folder containing the source code on the PYTHONPATH
but I am still getting the error: Importing test library 'CustomLibrary' failed: ImportError: No module named CustomLibrary
The CustomLibrary
class is defined in the __init__.py
file, like in the AppiumLibrary
like this:
from CustomLibrary.keywords import *
class CustomLibrary(_CustomKeywords):
ROBOT_LIBRARY_SCOPE = 'GLOBAL'
How can I solve this problem, so I can import it in Robot Framework? I want to keep the class definition inside the init file.
You need to make sure that the folder containing CustomLibrary
is on PYTHONPATH.
For example, the following works as expected for me:
Library CustomLibrary
robot --pythonpath /tmp example.robot
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.