Reputation: 2755
I had python file tests.py in project folder and I could call the methods as follows:
Library tests.Tests
But I moved tests.py to folder python_tests in same project folder but I can't seem to get path right. I tried below things
Library python_tests/tests.Tests
Library /python_tests/tests.Tests
Library /home/robot_project/python_tests/tests.Tests
Library home/robot_project/python_tests/tests.Tests
Upvotes: 1
Views: 802
Reputation: 386342
You must either use a pathname (absolute, or relative to the test), or a module name for a module on your path, but you can't mix the two techniques.
python_tests
is a package that is on your PYTHONPATH, python_tests.tests.Tests
should work. python_tests
in your PYTHONPATH, tests.Tests
should work.python_tests/tests/Tests.py
should work.This is all covered in the robot framework user guide, in the section titled Specifying library to import. Here are a couple of exerpts:
The most common way to specify a test library to import is using its name.... In these cases Robot Framework tries to find the class or module implementing the library from the module search path. Libraries that are installed somehow ought to be in the module search path automatically, but with other libraries the search path may need to be configured separately.
...
Another mechanism for specifying the library to import is using a path to it in the file system. This path is considered relative to the directory where current test data file is situated ... The main benefit of this approach is that there is no need to configure the module search path.
Upvotes: 2